diff --git a/packages/amis-editor-core/src/component/factory.tsx b/packages/amis-editor-core/src/component/factory.tsx index e08228f76..24267a9a2 100644 --- a/packages/amis-editor-core/src/component/factory.tsx +++ b/packages/amis-editor-core/src/component/factory.tsx @@ -82,11 +82,10 @@ export function makeWrapper( closestScope = manager.dataSchema.getScope( `${from.id}-${from.type}` ); - } else if (!from.parent) { - closestScope = manager.dataSchema.getScope('root'); - } + } - from = from.parent; + // node.parent 是找不到 root 那层的,所以需要自己加逻辑 + from = from.parentId === 'root' ? store.root : from.parent; } if (closestScope) {