fix
This commit is contained in:
parent
ecd2dc33f9
commit
3a50f00936
|
|
@ -33,10 +33,16 @@ export const treeRebuild = async (p: PG) => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(portal.out)) {
|
for (const [k, portal_out] of Object.entries(portal.out)) {
|
||||||
const name = k.replace(/⮕/gi, "").trim();
|
const name = k.replace(/⮕/gi, "").trim();
|
||||||
const portal_in = portal.in[`⬅${name}`];
|
const portal_in = portal.in[`⬅${name}`];
|
||||||
if (portal_in) {
|
if (portal_in) {
|
||||||
|
for (const key of Object.keys(portal_in)) {
|
||||||
|
delete (portal_in as any)[key];
|
||||||
|
}
|
||||||
|
for (const [k, v] of Object.entries(portal_out)) {
|
||||||
|
(portal_in as any)[k] = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,19 +99,21 @@ export const Editor: FC<{ site_id: string; page_id: string; session: any }> = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.status === "init") {
|
if (p.status === "init") {
|
||||||
(window as any).mok = ((window as any).mok || 0) + 1;
|
if (p.ui) {
|
||||||
p.ui.loading = <Loading note="load-page" />;
|
(window as any).mok = ((window as any).mok || 0) + 1;
|
||||||
p.ui.preload = <Loading note="preload-root" backdrop={false} />;
|
p.ui.loading = <Loading note="load-page" />;
|
||||||
p.ui.notfound = (
|
p.ui.preload = <Loading note="preload-root" backdrop={false} />;
|
||||||
<div className="flex-1 flex items-center justify-center">NOT FOUND</div>
|
p.ui.notfound = (
|
||||||
);
|
<div className="flex-1 flex items-center justify-center">NOT FOUND</div>
|
||||||
p.ui.error = (
|
);
|
||||||
<div className="flex-1 flex items-center justify-center">
|
p.ui.error = (
|
||||||
PREVIEW ERROR
|
<div className="flex-1 flex items-center justify-center">
|
||||||
</div>
|
PREVIEW ERROR
|
||||||
);
|
</div>
|
||||||
p.status = "loading";
|
);
|
||||||
initEditor(p, site_id);
|
p.status = "loading";
|
||||||
|
initEditor(p, site_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
routeEditor(p, page_id);
|
routeEditor(p, page_id);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export const ERender: FC<{
|
||||||
item.adv.js.startsWith("newElement")
|
item.adv.js.startsWith("newElement")
|
||||||
) {
|
) {
|
||||||
const mitem = meta.mitem;
|
const mitem = meta.mitem;
|
||||||
|
|
||||||
if (mitem && item.type === "item") {
|
if (mitem && item.type === "item") {
|
||||||
(async () => {
|
(async () => {
|
||||||
let childs: any[] = [];
|
let childs: any[] = [];
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,16 @@ export const treePropEval = (
|
||||||
value = {
|
value = {
|
||||||
_jsx: true,
|
_jsx: true,
|
||||||
Comp: ({
|
Comp: ({
|
||||||
|
prop_name,
|
||||||
parent_id,
|
parent_id,
|
||||||
_scopeIndex,
|
_scopeIndex,
|
||||||
}: {
|
}: {
|
||||||
|
prop_name: string;
|
||||||
parent_id: string;
|
parent_id: string;
|
||||||
_scopeIndex?: Record<string, string>;
|
_scopeIndex?: Record<string, string>;
|
||||||
}) => {
|
}) => {
|
||||||
|
console.log(prop_name);
|
||||||
|
|
||||||
if (prop.content) {
|
if (prop.content) {
|
||||||
const meta = p.treeMeta[prop.content.id];
|
const meta = p.treeMeta[prop.content.id];
|
||||||
if (meta) {
|
if (meta) {
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,19 @@ export const treeScopeEval = (
|
||||||
if (v && typeof v === "object") {
|
if (v && typeof v === "object") {
|
||||||
const t: {
|
const t: {
|
||||||
_jsx: true;
|
_jsx: true;
|
||||||
Comp: FC<{ parent_id: string; _scopeIndex?: Record<string, any> }>;
|
Comp: FC<{
|
||||||
|
prop_name: string;
|
||||||
|
parent_id: string;
|
||||||
|
_scopeIndex?: Record<string, any>;
|
||||||
|
}>;
|
||||||
} = v as any;
|
} = v as any;
|
||||||
if (t._jsx && t.Comp) {
|
if (t._jsx && t.Comp) {
|
||||||
finalScope[k] = (
|
finalScope[k] = (
|
||||||
<t.Comp parent_id={meta.item.id} _scopeIndex={_scopeIndex} />
|
<t.Comp
|
||||||
|
prop_name={k}
|
||||||
|
parent_id={meta.item.id}
|
||||||
|
_scopeIndex={_scopeIndex}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,8 @@ export const editorWS = async (p: PG) => {
|
||||||
}, 5000);
|
}, 5000);
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
ws.addEventListener("message", async (e) => {
|
ws.addEventListener("message", async (e) => {
|
||||||
|
if (!e.data || !e.data.arrayBuffer) return;
|
||||||
|
|
||||||
const raw = decoder.decode(
|
const raw = decoder.decode(
|
||||||
decompress(new Uint8Array(await e.data.arrayBuffer()))
|
decompress(new Uint8Array(await e.data.arrayBuffer()))
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export const AddElement: FC<{}> = ({}) => {
|
||||||
id: createId(),
|
id: createId(),
|
||||||
name: `New Text`,
|
name: `New Text`,
|
||||||
type: "text",
|
type: "text",
|
||||||
dim: { w: "full", h: "fit" },
|
dim: { w: "full", h: "full" },
|
||||||
layout: { align: "center", dir: "col", gap: 0 },
|
layout: { align: "center", dir: "col", gap: 0 },
|
||||||
text: "",
|
text: "",
|
||||||
html: "",
|
html: "",
|
||||||
|
|
@ -122,7 +122,7 @@ export const AddElement: FC<{}> = ({}) => {
|
||||||
id: createId(),
|
id: createId(),
|
||||||
name: `New Item`,
|
name: `New Item`,
|
||||||
type: "item",
|
type: "item",
|
||||||
dim: { w: "fit", h: "fit" },
|
dim: { w: "full", h: "full" },
|
||||||
childs: [],
|
childs: [],
|
||||||
adv: {
|
adv: {
|
||||||
css: "",
|
css: "",
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,7 @@ export const ETreeItemAction: FC<{
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (mitem) {
|
if (mitem) {
|
||||||
const ijson = mitem.toJSON() as IItem;
|
const ijson = mitem.toJSON() as IItem;
|
||||||
|
|
||||||
mitem.doc?.transact(() => {
|
mitem.doc?.transact(() => {
|
||||||
mitem.set("childs", new Y.Array());
|
|
||||||
syncronize(mitem as any, {
|
syncronize(mitem as any, {
|
||||||
...resetJSXProp,
|
...resetJSXProp,
|
||||||
name: ijson.name,
|
name: ijson.name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue