diff --git a/app/srv/ws/sync/actions/code_edit.ts b/app/srv/ws/sync/actions/code_edit.ts index 86d42cd8..5e54f037 100644 --- a/app/srv/ws/sync/actions/code_edit.ts +++ b/app/srv/ws/sync/actions/code_edit.ts @@ -48,7 +48,6 @@ export const code_edit: SAction["code"]["edit"] = async function ( if (root) { const mitem = findId(root, item_id); - if (mitem) { if (arg.type === "adv") { const mode = arg.mode; @@ -228,15 +227,14 @@ const findId = (mitem: MContent | MRoot, id: string) => { if (!found) { const mprops = m.get("component")?.get("props"); + if (mprops) { mprops.forEach((mprop) => { - if (mprop.get("meta")?.get("type") === "content-element") { - const mcontent = mprop.get("content"); - if (mcontent) { - const f = findId(mcontent, id); - if (f) { - found = f; - } + const mcontent = mprop.get("content"); + if (mcontent) { + const f = findId(mcontent, id); + if (f) { + found = f; } } }); diff --git a/app/web/src/nova/ed/panel/header/mid/add-item.tsx b/app/web/src/nova/ed/panel/header/mid/add-item.tsx index 9311bf0b..d8ae5f47 100644 --- a/app/web/src/nova/ed/panel/header/mid/add-item.tsx +++ b/app/web/src/nova/ed/panel/header/mid/add-item.tsx @@ -38,6 +38,16 @@ export const EdAddItem = () => { }, } as IItem; + if (meta.item.component?.id && meta.item.component.props.child) { + const child_id = meta.item.component.props.child.content?.id; + if (child_id) { + const child_meta = getMetaById(p, child_id); + if (child_meta) { + meta = child_meta; + } + } + } + let mitem = meta.mitem; if (mitem) { const item = meta.item as IContent; diff --git a/app/web/src/nova/ed/panel/header/mid/add-text.tsx b/app/web/src/nova/ed/panel/header/mid/add-text.tsx index 5b54c64f..84bc81db 100644 --- a/app/web/src/nova/ed/panel/header/mid/add-text.tsx +++ b/app/web/src/nova/ed/panel/header/mid/add-text.tsx @@ -28,6 +28,16 @@ export const EdAddText = () => { } if (!meta) return null; + if (meta.item.component?.id && meta.item.component.props.child) { + const child_id = meta.item.component.props.child.content?.id; + if (child_id) { + const child_meta = getMetaById(p, child_id); + if (child_meta) { + meta = child_meta; + } + } + } + meta.mitem?.doc?.transact(() => { if (!meta) return null; @@ -45,6 +55,7 @@ export const EdAddText = () => { } as IText; let mitem = meta.mitem as MContent; + if (mitem) { const item = meta.item as IContent; 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 76dd411d..4fcb0bdf 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -9,7 +9,7 @@ import { jscript } from "../../../../../utils/script/jscript"; import { jsMount } from "../../../../../utils/script/mount"; import { monacoTypings } from "../../../../../utils/script/typings"; import { Loading } from "../../../../../utils/ui/loading"; -import { getActiveMeta } from "../../../logic/active/get-meta"; +import { getActiveMeta, getMetaById } from "../../../logic/active/get-meta"; import { EDGlobal, IMeta, active } from "../../../logic/ed-global"; import { edMonacoDefaultVal } from "./default-val"; import { declareScope } from "./scope/scope"; @@ -169,7 +169,6 @@ declare global { } ` ); - } const nmodel = monaco.editor.createModel( @@ -398,7 +397,7 @@ declare global { clearTimeout(scriptEdit.timeout); const applyChanges = async () => { if (!p.sync) return; - + const value = local.value; const meta = getActiveMeta(p); const mode = p.ui.popup.script.mode; diff --git a/app/web/src/nova/ed/panel/tree/node/item/name.tsx b/app/web/src/nova/ed/panel/tree/node/item/name.tsx index dcb861ce..218bc376 100644 --- a/app/web/src/nova/ed/panel/tree/node/item/name.tsx +++ b/app/web/src/nova/ed/panel/tree/node/item/name.tsx @@ -24,13 +24,18 @@ export const EdTreeName = ({ const item = node.data?.item; if (!item) return <>>; - const is_jsx_prop = !!node.data?.jsx_prop?.is_root; + let is_jsx_prop = !!node.data?.jsx_prop?.is_root; const isRenaming = p.ui.tree.rename_id === item.id; let name = item.name; if (item.component?.id && p.comp.loaded[item.component.id]) { name = p.comp.loaded[item.component.id].name; + + if (item.component.props.child) { + is_jsx_prop = true; + } } + return (