fix(global-sections): block structural edits inside a global-section instance
syncInstances rebuilds an instance's subtree from the master, so a node dropped, pasted, duplicated or moved into an instance vanished from every page on the next master edit. Chosen approach: BLOCK (not preserve-on-sync): - every resolver component's Craft canMoveIn/canMoveOut refuses a canvas inside an instance (canvas DnD, Layers DnD, actions.move); synthetic shell-inner nodes now carry the component's rules instead of hardcoded allow-all - insertBlock (BlocksPanel / EmptyContainerAdd / palette), paste (menu + shortcut), duplicate (menu + shortcut) and Sitesmith patch/section replace redirect to after the instance or refuse; no empty-container '+' inside one The instance root still moves/duplicates as a whole; content overrides are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca500d36a9
commit
6d22aabdc0
11 files changed
+271
-17
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useCallback, useRef, useState } from 'react';
|
||||
import { insertTargetOutsideInstance } from '../../utils/global-sections';
|
||||
import { useEditor } from '@craftjs/core';
|
||||
import { useSitesmithModal } from '../../state/SitesmithContext';
|
||||
import { buildSitesmithTarget } from '../../utils/sitesmith-target';
|
||||
@@ -181,11 +182,14 @@ export const ContextMenu: React.FC<ContextMenuProps> = ({
|
||||
}
|
||||
}
|
||||
|
||||
// #57: pasting next to a node inside an instance lands after the instance.
|
||||
const at = insertTargetOutsideInstance(query, targetParent, insertIndex);
|
||||
if (!at) { onClose(); return; }
|
||||
const tree = regenerateTreeIds(clip);
|
||||
if (insertIndex !== undefined) {
|
||||
actions.addNodeTree(tree, targetParent, insertIndex);
|
||||
if (at.index !== undefined) {
|
||||
actions.addNodeTree(tree, at.parentId, at.index);
|
||||
} else {
|
||||
actions.addNodeTree(tree, targetParent);
|
||||
actions.addNodeTree(tree, at.parentId);
|
||||
}
|
||||
actions.selectNode(tree.rootNodeId);
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user