diff --git a/app/srv/ws/sync/actions/code_edit.ts b/app/srv/ws/sync/actions/code_edit.ts index 22cf2d21..bc53ed56 100644 --- a/app/srv/ws/sync/actions/code_edit.ts +++ b/app/srv/ws/sync/actions/code_edit.ts @@ -87,7 +87,23 @@ export const code_edit: SAction["code"]["edit"] = async function ( } } } - }, "server"); + }); + + 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(); } @@ -109,6 +125,22 @@ 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(); } @@ -151,6 +183,12 @@ 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(); }