diff --git a/app/web/src/nova/ed/panel/popup/script/monaco.tsx b/app/web/src/nova/ed/panel/popup/script/monaco.tsx index 62d8f461..9b5ba3b8 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -159,24 +159,30 @@ export const ScriptMonaco = () => { openCodeEditor(source, r, selectionOrPosition) { const cpath = r.path.substring(`scope~`.length).split("__"); const comp_id = cpath[0]; - const path = cpath[1].split("~"); - const type = path[0] as "prop" | "passprop" | "local"; - const id = path[path.length - 1].replace(".d.ts", ""); + if (cpath[1]) { + const path = cpath[1].split("~"); + const type = path[0] as "prop" | "passprop" | "local"; + const id = path[path.length - 1].replace(".d.ts", ""); - if (comp_id) { - let meta = p.page.meta[id]; - if (active.comp_id) { - meta = p.comp.list[active.comp_id].meta[id]; + if (type === "prop") { + return false; } - if (meta && meta.item.originalId) { - active.item_id = meta.item.originalId; + if (comp_id) { + let meta = p.page.meta[id]; + if (active.comp_id) { + meta = p.comp.list[active.comp_id].meta[id]; + } + + if (meta && meta.item.originalId) { + active.item_id = meta.item.originalId; + } + active.comp_id = comp_id; + } else { + active.item_id = id; } - active.comp_id = comp_id; - } else { - active.item_id = id; + p.render(); } - p.render(); return false; }, diff --git a/app/web/src/nova/ed/panel/popup/script/scope.tsx b/app/web/src/nova/ed/panel/popup/script/scope.tsx index 9281246f..022d20eb 100644 --- a/app/web/src/nova/ed/panel/popup/script/scope.tsx +++ b/app/web/src/nova/ed/panel/popup/script/scope.tsx @@ -18,6 +18,8 @@ export const declareScope = async ( if (!s) return; + s.p.push(active_id); + monaco.editor.getModels().forEach((model) => { if (model.uri.toString().startsWith("ts:scope~")) { model.dispose();