diff --git a/app/web/src/base/page/ed.tsx b/app/web/src/base/page/ed.tsx index 27713c90..dd2719d7 100644 --- a/app/web/src/base/page/ed.tsx +++ b/app/web/src/base/page/ed.tsx @@ -9,6 +9,16 @@ export default page({ component: ({}) => { const p = useGlobal(EDGlobal, "EDITOR"); + const w = window as any; + if (!w.Y) { + (async () => { + (window as any).Y = await import("yjs"); + (window as any).syncronize = (await import("y-pojo")).syncronize; + p.render(); + })(); + return ; + } + if (!edInitSync(p)) { return ; } diff --git a/app/web/src/index.tsx b/app/web/src/index.tsx index 8f2424f3..0390a7b7 100644 --- a/app/web/src/index.tsx +++ b/app/web/src/index.tsx @@ -4,12 +4,9 @@ import { Root } from "./base/root"; import "./index.css"; import { createAPI, createDB, reloadDBAPI } from "./utils/script/init-api"; import { w } from "./utils/types/general"; -import * as Y from "yjs"; import { registerMobile } from "./render/live/logic/mobile"; import { isLocalhost } from "./utils/ui/is-localhost"; -(window as any).Y = Y; - const start = async () => { const base = `${location.protocol}//${location.host}`; let react = { @@ -142,7 +139,7 @@ const start = async () => { }); } } - + defineReact(); await defineWindow(false); w.serverurl = base; diff --git a/app/web/src/nova/ed/logic/tree/build.tsx b/app/web/src/nova/ed/logic/tree/build.tsx index 9194f202..b0a33f5c 100644 --- a/app/web/src/nova/ed/logic/tree/build.tsx +++ b/app/web/src/nova/ed/logic/tree/build.tsx @@ -54,7 +54,7 @@ export const treeRebuild = async (p: PG, arg?: { note?: string }) => { p.page.entry.push(e.get("id")); } syncWalkMap(p, { - isLayout: false, + isLayout: true, mitem: e, parent_item: { id: root_id }, tree_root_id: root_id, diff --git a/app/web/src/nova/ed/logic/tree/sync-walk.tsx b/app/web/src/nova/ed/logic/tree/sync-walk.tsx index cd0b3af4..da3bfbcc 100644 --- a/app/web/src/nova/ed/logic/tree/sync-walk.tsx +++ b/app/web/src/nova/ed/logic/tree/sync-walk.tsx @@ -193,6 +193,7 @@ export const syncWalkMap = ( parent_mcomp: { mitem: mitem as MItem, mcomp }, portal: arg.portal, skip_add_tree: skip_tree_child, + each: arg.each, }); } } @@ -211,6 +212,7 @@ export const syncWalkMap = ( parent_mcomp: { mitem: mitem as MItem, mcomp }, skip_add_tree: true, portal: arg.portal, + each: arg.each, }); } return; @@ -258,6 +260,7 @@ export const syncWalkMap = ( parent_mcomp: arg.parent_mcomp, portal: arg.portal, skip_add_tree: skip_tree_child, + each: arg.each, }); } };