fix
This commit is contained in:
parent
7d405e5145
commit
d79e7ec11e
|
|
@ -1,5 +1,5 @@
|
||||||
import { FC, useEffect } from "react";
|
import { FC, useEffect } from "react";
|
||||||
import { useGlobal, deepClone } from "web-utils";
|
import { useGlobal, deepClone, waitUntil } from "web-utils";
|
||||||
import { Loading } from "../../utils/ui/loading";
|
import { Loading } from "../../utils/ui/loading";
|
||||||
import { EMainEditor } from "./panel/e-main-editor";
|
import { EMainEditor } from "./panel/e-main-editor";
|
||||||
import { EditorGlobal } from "./logic/global";
|
import { EditorGlobal } from "./logic/global";
|
||||||
|
|
@ -126,6 +126,9 @@ export const Editor: FC<{ site_id: string; page_id: string; session: any }> = ({
|
||||||
return p.ui.error;
|
return p.ui.error;
|
||||||
}
|
}
|
||||||
if (!p.site.id) {
|
if (!p.site.id) {
|
||||||
|
waitUntil(() => p.site?.id).then(() => {
|
||||||
|
p.render();
|
||||||
|
});
|
||||||
return <Loading note="editor-prepare" />;
|
return <Loading note="editor-prepare" />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@ import {
|
||||||
import { LSite } from "../../live/logic/global";
|
import { LSite } from "../../live/logic/global";
|
||||||
import { validateLayout } from "../../live/logic/layout";
|
import { validateLayout } from "../../live/logic/layout";
|
||||||
import importModule from "../tools/dynamic-import";
|
import importModule from "../tools/dynamic-import";
|
||||||
import { PG } from "./global";
|
import { EditorGlobal, PG } from "./global";
|
||||||
import { devLoader } from "../../live/dev-loader";
|
import { devLoader } from "../../live/dev-loader";
|
||||||
import { jscript } from "../../../utils/script/jscript";
|
import { jscript } from "../../../utils/script/jscript";
|
||||||
|
import { deepClone } from "web-utils";
|
||||||
|
|
||||||
export const w = window as unknown as {
|
export const w = window as unknown as {
|
||||||
basepath: string;
|
basepath: string;
|
||||||
|
|
@ -29,6 +30,7 @@ export const w = window as unknown as {
|
||||||
devUrl: string;
|
devUrl: string;
|
||||||
prodUrl: string;
|
prodUrl: string;
|
||||||
};
|
};
|
||||||
|
blankGlobal: typeof EditorGlobal;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initEditor = async (p: PG, site_id: string) => {
|
export const initEditor = async (p: PG, site_id: string) => {
|
||||||
|
|
@ -50,7 +52,10 @@ export const initEditor = async (p: PG, site_id: string) => {
|
||||||
jscript.init(p.render);
|
jscript.init(p.render);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p.item) return;
|
if (!p.item) {
|
||||||
|
location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
p.item.active = localStorage.getItem("prasi-item-active-id") || "";
|
p.item.active = localStorage.getItem("prasi-item-active-id") || "";
|
||||||
p.item.activeOriginalId = localStorage.getItem("prasi-item-active-oid") || "";
|
p.item.activeOriginalId = localStorage.getItem("prasi-item-active-oid") || "";
|
||||||
|
|
@ -84,6 +89,7 @@ export const initEditor = async (p: PG, site_id: string) => {
|
||||||
localStorage.setItem(`prasi-site-${site_id}`, JSON.stringify(site));
|
localStorage.setItem(`prasi-site-${site_id}`, JSON.stringify(site));
|
||||||
return site;
|
return site;
|
||||||
};
|
};
|
||||||
|
|
||||||
const processSite = async (site: LSite) => {
|
const processSite = async (site: LSite) => {
|
||||||
if (!site || (site && !site.id)) return;
|
if (!site || (site && !site.id)) return;
|
||||||
if (!w.exports) {
|
if (!w.exports) {
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,10 @@ if (g.db) {
|
||||||
|
|
||||||
await initSrv();
|
await initSrv();
|
||||||
await syncActionDefinition();
|
await syncActionDefinition();
|
||||||
|
|
||||||
await generateAPIFrm();
|
await generateAPIFrm();
|
||||||
await prepareApiRoutes();
|
await prepareApiRoutes();
|
||||||
|
|
||||||
await prepareAPITypes();
|
await prepareAPITypes();
|
||||||
|
|
||||||
await parcelBuild();
|
await parcelBuild();
|
||||||
|
await createServer();
|
||||||
|
|
||||||
// await createServer();
|
g.status = "ready";
|
||||||
|
|
||||||
// g.status = "ready";
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue