diff --git a/app/srv/ws/sync/actions/code_edit.ts b/app/srv/ws/sync/actions/code_edit.ts index bc53ed56..22cf2d21 100644 --- a/app/srv/ws/sync/actions/code_edit.ts +++ b/app/srv/ws/sync/actions/code_edit.ts @@ -87,23 +87,7 @@ export const code_edit: SAction["code"]["edit"] = async function ( } } } - }); - - if (save_to === "comp" && comp_id) { - db.component.update({ - where: { id: comp_id }, - data: { - content_tree: root.toJSON(), - }, - }); - } else if (page_id) { - db.page.update({ - where: { id: page_id }, - data: { - content_tree: root.toJSON(), - }, - }); - } + }, "server"); } catch (e: any) { return e.message.toString(); } @@ -125,22 +109,6 @@ export const code_edit: SAction["code"]["edit"] = async function ( mprop.set("value", src); mprop.set("valueBuilt", res.code.substring(6)); }); - - if (save_to === "comp" && comp_id) { - db.component.update({ - where: { id: comp_id }, - data: { - content_tree: root.toJSON(), - }, - }); - } else if (page_id) { - db.page.update({ - where: { id: page_id }, - data: { - content_tree: root.toJSON(), - }, - }); - } } catch (e: any) { return e.message.toString(); } @@ -183,12 +151,6 @@ export const code_edit: SAction["code"]["edit"] = async function ( } } }); - await db.component.update({ - where: { id: comp_id }, - data: { - content_tree: root.toJSON(), - }, - }); } catch (e: any) { return e.message.toString(); } diff --git a/app/web/src/nova/ed/logic/ed-route.ts b/app/web/src/nova/ed/logic/ed-route.ts index feb33130..08b6ea30 100644 --- a/app/web/src/nova/ed/logic/ed-route.ts +++ b/app/web/src/nova/ed/logic/ed-route.ts @@ -129,7 +129,12 @@ export const reloadLayout = async (p: PG, layout_id: string, note: string) => { } }; -export const reloadPage = async (p: PG, page_id: string, note: string) => { +export const reloadPage = async ( + p: PG, + page_id: string, + note: string, + should_render?: boolean +) => { p.status = "reload"; const remotePage = await p.sync.page.load(page_id); @@ -219,7 +224,7 @@ export const reloadPage = async (p: PG, page_id: string, note: string) => { } p.status = "ready"; - p.render(); + if (should_render !== false) p.render(); }; export const loadPageMetaCache = async (p: PG, page_id: string) => { 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 bcd3e1cb..5324126b 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -305,9 +305,10 @@ export const EdScriptMonaco: FC<{}> = () => { const stype = p.ui.popup.script.type; p.ui.popup.script.typings.status = "loading"; p.ui.popup.script.wb_render(); + if ((value || "").includes(IMPORT_SEPARATOR)) { - const valparts = (value || "").split(IMPORT_SEPARATOR + "\n"); - if (valparts.length === 2) local.value = valparts[1]; + const valparts = (value || "").split(IMPORT_SEPARATOR); + if (valparts.length > 1) local.value = valparts[1]; if ( stype === "prop-instance" && local.value.includes( @@ -361,6 +362,7 @@ export const EdScriptMonaco: FC<{}> = () => { scope = code_result; } } else { + console.log(value); const code_result = await p.sync.code.edit({ type: "adv", mode: mode, diff --git a/app/web/src/nova/vi/preview.tsx b/app/web/src/nova/vi/preview.tsx index 844f6311..2b24bf31 100644 --- a/app/web/src/nova/vi/preview.tsx +++ b/app/web/src/nova/vi/preview.tsx @@ -79,15 +79,11 @@ export const ViPreview = (arg: { pathname: string }) => { const mode = p.mode; - if (!w.isEditor && !p.preview.meta_cache[params.page_id]) { - savePageMetaCache(p, p.page.meta); - } - return (