mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-06-29 03:58:17 +08:00
fix(vue-runtime-help): handle remove when root is not initialized
When root is empty but RemoveData carries app config, update root instead of throwing.
This commit is contained in:
parent
7bbb1f24c0
commit
af197363cf
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"name": "@tmagic/vue-runtime-help",
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
|
||||
@ -138,8 +138,14 @@ export const useEditorDsl = (app = inject<TMagicApp>('app'), runtimeApi: Runtime
|
||||
}
|
||||
},
|
||||
|
||||
remove: ({ id, parentId }: RemoveData) => {
|
||||
if (!root.value) throw new Error('error');
|
||||
remove: ({ id, parentId, root: appConfig }: RemoveData) => {
|
||||
if (!root.value) {
|
||||
if (appConfig) {
|
||||
updateRoot(appConfig);
|
||||
return;
|
||||
}
|
||||
throw new Error('error');
|
||||
}
|
||||
|
||||
const node = getNodePath(id, [root.value]).pop();
|
||||
if (!node) throw new Error('未找到目标元素');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user