diff --git a/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx b/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx index 64dd5e5f..4b00bb03 100644 --- a/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx +++ b/app/web/src/nova/ed/panel/popup/script/scope/scope.tsx @@ -41,8 +41,8 @@ export const declareScope = async ( map_childs(metas, entry, paths); const added = new Set(); for (const path of paths) { + console.log(path.map((e) => e.item.name)); const exim = scopeMapExportImport(p, meta, path); - for (const [k, v] of Object.entries(exim.exports)) { for (const [filename, src] of Object.entries(v)) { if (!added.has(filename)) { @@ -64,32 +64,35 @@ const map_childs = ( for (const m of childs) { const meta = metas[m.id]; if (meta) { - let cur: null | IMeta[] = null; - for (const path of paths) { - if (path[path.length - 1] === parent) { - cur = path; - cur.push(meta); - break; - } - } - - if (!cur) { - paths.push([...(curpath || []), meta]); - cur = paths[paths.length - 1]; - } - - if (cur) { - if ( - meta.item.type === "item" && - meta.item.component?.id && - meta.item.component?.id !== active.comp_id - ) { - continue; - } else { - if (Array.isArray(meta.item.childs)) { - map_childs(metas, meta.item.childs, paths, cur, meta); + paths.push([...(curpath || []), meta]); + if ( + meta.item.type === "item" && + meta.item.component?.id && + meta.item.component?.id !== active.comp_id + ) { + if (meta.item.component?.props) { + for (const [_, p] of Object.entries(meta.item.component.props)) { + if (p.meta?.type === "content-element" && p.content) { + map_childs( + metas, + [p.content], + paths, + [...(curpath || []), meta], + meta + ); + } } } + } else { + if (Array.isArray(meta.item.childs)) { + map_childs( + metas, + meta.item.childs, + paths, + [...(curpath || []), meta], + meta + ); + } } } } diff --git a/app/web/src/nova/ed/panel/tree/node/item/action/del.tsx b/app/web/src/nova/ed/panel/tree/node/item/action/del.tsx index 16974276..ebf1226c 100644 --- a/app/web/src/nova/ed/panel/tree/node/item/action/del.tsx +++ b/app/web/src/nova/ed/panel/tree/node/item/action/del.tsx @@ -34,9 +34,6 @@ export const edActionDeleteById = async (p: PG, id: string) => { const deleteByParent = (p: PG, mitem: MItem, index: number) => { const mchild = mitem.parent.get(index); - const child = mchild?.toJSON() as IItem; - - console.log(child); mitem.parent.delete(index); treeRebuild(p); };