fix blank
This commit is contained in:
parent
297cd61228
commit
7b5b9bb9a0
|
|
@ -16,6 +16,7 @@ const start = async () => {
|
||||||
w.api = createAPI(base);
|
w.api = createAPI(base);
|
||||||
w.db = createDB(base);
|
w.db = createDB(base);
|
||||||
|
|
||||||
|
if (!["localhost", "127.0.0.1"].includes(location.hostname)) {
|
||||||
navigator.serviceWorker.addEventListener("message", (e) => {
|
navigator.serviceWorker.addEventListener("message", (e) => {
|
||||||
if (e.data.type === "activated") {
|
if (e.data.type === "activated") {
|
||||||
if (e.data.shouldRefresh && sw) {
|
if (e.data.shouldRefresh && sw) {
|
||||||
|
|
@ -46,6 +47,13 @@ const start = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||||
|
for (let registration of registrations) {
|
||||||
|
registration.unregister();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const el = document.getElementById("root");
|
const el = document.getElementById("root");
|
||||||
if (el) {
|
if (el) {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import { fillID } from "../tools/fill-id";
|
||||||
import { newMap } from "../tools/yjs-tools";
|
import { newMap } from "../tools/yjs-tools";
|
||||||
import { ComponentOver, ElProp, createElProp } from "./e-relprop";
|
import { ComponentOver, ElProp, createElProp } from "./e-relprop";
|
||||||
import { ETextInternal } from "./e-text";
|
import { ETextInternal } from "./e-text";
|
||||||
|
import { DefaultScript } from "../panel/script/monaco/monaco-el";
|
||||||
|
|
||||||
export const ERender: FC<{
|
export const ERender: FC<{
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -174,7 +175,14 @@ export const ERender: FC<{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adv && adv.js && !adv.jsBuilt && meta.mitem) {
|
if (
|
||||||
|
adv &&
|
||||||
|
adv.js &&
|
||||||
|
typeof adv.js === "string" &&
|
||||||
|
adv.js.replace(/\W/gi, "") !== DefaultScript.js.replace(/\W/gi, "") &&
|
||||||
|
!adv.jsBuilt &&
|
||||||
|
meta.mitem
|
||||||
|
) {
|
||||||
if (!jscript.build) {
|
if (!jscript.build) {
|
||||||
jscript.init().then(() => {
|
jscript.init().then(() => {
|
||||||
p.render();
|
p.render();
|
||||||
|
|
@ -188,12 +196,22 @@ export const ERender: FC<{
|
||||||
undefined,
|
undefined,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.then((js) => {});
|
.then((js) => {
|
||||||
|
console.log(js);
|
||||||
|
if (meta.mitem) {
|
||||||
|
const adv = meta.mitem.get("adv");
|
||||||
|
if (adv) adv.set("jsBuilt", js);
|
||||||
|
if (item.adv) {
|
||||||
|
item.adv.jsBuilt = js;
|
||||||
|
}
|
||||||
|
p.render();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(adv?.jsBuilt && adv?.js) && (meta.scopeAttached || meta.comp)) {
|
if (!(adv?.jsBuilt && adv?.js) && meta.comp) {
|
||||||
return treeScopeEval(
|
return treeScopeEval(
|
||||||
p,
|
p,
|
||||||
id,
|
id,
|
||||||
|
|
@ -242,7 +260,6 @@ export const ERender: FC<{
|
||||||
<div className={className} {...elprop}>
|
<div className={className} {...elprop}>
|
||||||
{/* <pre className={"text-[9px] font-mono text-black"}>
|
{/* <pre className={"text-[9px] font-mono text-black"}>
|
||||||
{item.id}-{item.name}
|
{item.id}-{item.name}
|
||||||
{item.name === "coba" && JSON.stringify(item.childs)}
|
|
||||||
</pre> */}
|
</pre> */}
|
||||||
{_children}
|
{_children}
|
||||||
{componentOver}
|
{componentOver}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ export type ItemMeta = {
|
||||||
parent_comp?: WithRequired<ItemMeta, "comp"> & { item: IItem };
|
parent_comp?: WithRequired<ItemMeta, "comp"> & { item: IItem };
|
||||||
parent_prop?: ItemMeta;
|
parent_prop?: ItemMeta;
|
||||||
scope?: any;
|
scope?: any;
|
||||||
scopeAttached?: { meta: ItemMeta; value: any }[];
|
|
||||||
className?: string;
|
className?: string;
|
||||||
elprop?: any;
|
elprop?: any;
|
||||||
depth: number;
|
depth: number;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue