This commit is contained in:
Rizky 2024-01-25 16:14:53 +07:00
parent ce4b1a5f7a
commit 57b4bf9c24
3 changed files with 25 additions and 19 deletions

View File

@ -4,7 +4,6 @@ import { fetchViaProxy } from "../proxy";
export const loadApiProxyDef = async (_url: string, with_types: boolean) => {
const url = trim(_url, "/");
console.log(url, _url);
const raw = await fetchViaProxy(urlPath(url, "/_prasi/_"));
let ver = "";
if (raw && (raw as any).prasi) {

View File

@ -6,25 +6,27 @@ import { Loading } from "../../utils/ui/loading";
import init from "wasm-gzip";
export default page({
url: "/ed/:site_id/:page_id",
component: ({}) => {
const p = useGlobal(EDGlobal, "EDITOR");
url: "/ed/:site_id/:page_id",
component: ({}) => {
const p = useGlobal(EDGlobal, "EDITOR");
const w = window as any;
if (!w.Y) {
(async () => {
await init();
(window as any).Y = await import("yjs");
(window as any).syncronize = (await import("y-pojo")).syncronize;
p.render();
})();
return <Loading note="init" />;
}
const w = window as any;
if (!w.Y) {
(async () => {
await init();
(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" />;
}
w.isEditor = true;
return <EdBase />;
},
if (!edInitSync(p)) {
return <Loading note="connecting-ws" />;
}
return <EdBase />;
},
});

View File

@ -7,6 +7,7 @@ import { ViRoot } from "./root";
import { ErrorBox } from "./utils/error-box";
import { render_stat } from "./render/render";
const w = window as any;
export const Vi: FC<{
meta: Record<string, IMeta>;
mode: "mobile" | "desktop";
@ -36,6 +37,10 @@ export const Vi: FC<{
}) => {
const vi = useGlobal(ViGlobal, "VI");
vi.mode = mode;
w.isMobile = mode === "mobile";
w.isDesktop = mode === "desktop";
vi.on_status_changes = on_status_changed;
if (rs === "disabled") {