This commit is contained in:
Rizky 2023-11-24 06:44:03 +07:00
parent a296b35eff
commit 9bcb823201
4 changed files with 15 additions and 5 deletions

View File

@ -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 <Loading note="init" />;
}
if (!edInitSync(p)) {
return <Loading note="connecting-ws" />;
}

View File

@ -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;

View File

@ -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,

View File

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