wip fix code edit

This commit is contained in:
Rizky 2024-01-28 06:48:11 +07:00
parent ddab876d8c
commit 2737342ba7
1 changed files with 39 additions and 1 deletions

View File

@ -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();
}