mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-01 10:14:56 -05:00
fix(lock): fix toggle locked target state and draggable check
1. BATCH_TOGGLE_LOCKED now uses first block from blocksToToggle set instead of blockIds[0], matching BATCH_TOGGLE_ENABLED pattern. Also added early exit if blocksToToggle is empty. 2. Blocks inside locked containers are now properly non-draggable. Changed draggable check from !block.locked to use isBlockProtected() which checks both block lock and parent container lock. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2156,7 +2156,7 @@ const WorkflowContent = React.memo(() => {
|
||||
parentId: block.data?.parentId,
|
||||
extent: block.data?.extent || undefined,
|
||||
dragHandle: '.workflow-drag-handle',
|
||||
draggable: !block.locked,
|
||||
draggable: !isBlockProtected(block.id, blocks),
|
||||
data: {
|
||||
...block.data,
|
||||
name: block.name,
|
||||
@@ -2192,7 +2192,7 @@ const WorkflowContent = React.memo(() => {
|
||||
position,
|
||||
parentId: block.data?.parentId,
|
||||
dragHandle,
|
||||
draggable: !block.locked,
|
||||
draggable: !isBlockProtected(block.id, blocks),
|
||||
extent: (() => {
|
||||
// Clamp children to subflow body (exclude header)
|
||||
const parentId = block.data?.parentId as string | undefined
|
||||
|
||||
@@ -870,8 +870,10 @@ async function handleBlocksOperationTx(
|
||||
}
|
||||
}
|
||||
|
||||
// Determine target locked state based on first block
|
||||
const firstBlock = blocksById[blockIds[0]]
|
||||
// Determine target locked state based on first toggleable block
|
||||
if (blocksToToggle.size === 0) break
|
||||
const firstToggleableId = Array.from(blocksToToggle)[0]
|
||||
const firstBlock = blocksById[firstToggleableId]
|
||||
if (!firstBlock) break
|
||||
const targetLocked = !firstBlock.locked
|
||||
|
||||
|
||||
Reference in New Issue
Block a user