wip fix
This commit is contained in:
parent
4bfdbef581
commit
a05d3af1a3
|
|
@ -9,8 +9,14 @@ import { docs } from "../entity/docs";
|
||||||
import { gunzipAsync } from "../entity/zlib";
|
import { gunzipAsync } from "../entity/zlib";
|
||||||
import { SyncConnection } from "../type";
|
import { SyncConnection } from "../type";
|
||||||
import { parseJs } from "../editor/parser/parse-js";
|
import { parseJs } from "../editor/parser/parse-js";
|
||||||
|
import { snapshot } from "../entity/snapshot";
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
|
const timeout = {
|
||||||
|
page: {} as Record<string, any>,
|
||||||
|
comp: {} as Record<string, any>,
|
||||||
|
};
|
||||||
|
|
||||||
export const code_edit: SAction["code"]["edit"] = async function (
|
export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
this: SyncConnection,
|
this: SyncConnection,
|
||||||
arg
|
arg
|
||||||
|
|
@ -84,14 +90,14 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
});
|
});
|
||||||
|
|
||||||
if (save_to === "comp" && comp_id) {
|
if (save_to === "comp" && comp_id) {
|
||||||
await db.component.update({
|
db.component.update({
|
||||||
where: { id: comp_id },
|
where: { id: comp_id },
|
||||||
data: {
|
data: {
|
||||||
content_tree: root.toJSON(),
|
content_tree: root.toJSON(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (page_id) {
|
} else if (page_id) {
|
||||||
await db.page.update({
|
db.page.update({
|
||||||
where: { id: page_id },
|
where: { id: page_id },
|
||||||
data: {
|
data: {
|
||||||
content_tree: root.toJSON(),
|
content_tree: root.toJSON(),
|
||||||
|
|
@ -121,14 +127,14 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
});
|
});
|
||||||
|
|
||||||
if (save_to === "comp" && comp_id) {
|
if (save_to === "comp" && comp_id) {
|
||||||
await db.component.update({
|
db.component.update({
|
||||||
where: { id: comp_id },
|
where: { id: comp_id },
|
||||||
data: {
|
data: {
|
||||||
content_tree: root.toJSON(),
|
content_tree: root.toJSON(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (page_id) {
|
} else if (page_id) {
|
||||||
await db.page.update({
|
db.page.update({
|
||||||
where: { id: page_id },
|
where: { id: page_id },
|
||||||
data: {
|
data: {
|
||||||
content_tree: root.toJSON(),
|
content_tree: root.toJSON(),
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ const viRoute = async (p: PG) => {
|
||||||
|
|
||||||
p.script.init_local_effect = {};
|
p.script.init_local_effect = {};
|
||||||
|
|
||||||
if (!w.isEditor) {
|
if (!w.isEditor && p.page.cur.id !== params.page_id) {
|
||||||
let page_cache = p.preview.meta_cache[params.page_id];
|
let page_cache = p.preview.meta_cache[params.page_id];
|
||||||
|
|
||||||
let should_render = false;
|
let should_render = false;
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,22 @@ export const ViChild: FC<{
|
||||||
const childs: ReactNode[] = [];
|
const childs: ReactNode[] = [];
|
||||||
for (const item_id of vi.entry) {
|
for (const item_id of vi.entry) {
|
||||||
const meta = vi.meta[item_id];
|
const meta = vi.meta[item_id];
|
||||||
const parts = viParts(vi, meta, false, passprop);
|
|
||||||
if (vi.visit) vi.visit(meta, parts);
|
if (meta.item.adv?.js || meta.item.component?.id) {
|
||||||
childs.push(<div {...parts.props} />);
|
childs.push(
|
||||||
|
<ErrorBox meta={meta}>
|
||||||
|
<ViScript
|
||||||
|
meta={meta}
|
||||||
|
is_layout={is_layout}
|
||||||
|
passprop={passprop}
|
||||||
|
></ViScript>
|
||||||
|
</ErrorBox>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const parts = viParts(vi, meta, false, passprop);
|
||||||
|
if (vi.visit) vi.visit(meta, parts);
|
||||||
|
childs.push(<div {...parts.props} />);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export const ViRoot: FC<{}> = ({}) => {
|
||||||
entry = vi.layout?.entry;
|
entry = vi.layout?.entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-1 flex-col relative">
|
<div className="flex flex-1 flex-col relative">
|
||||||
{entry.map((id) => {
|
{entry.map((id) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue