wip fix root
This commit is contained in:
parent
4d47bafb8e
commit
5d1e8b2ee9
|
|
@ -65,7 +65,7 @@ export const comp_new: SAction["comp"]["new"] = async function (
|
||||||
} else if (comp_id) {
|
} else if (comp_id) {
|
||||||
const doc = docs.comp[comp_id].doc;
|
const doc = docs.comp[comp_id].doc;
|
||||||
doc.transact(() => {
|
doc.transact(() => {
|
||||||
const root = doc.getMap("map").get("item");
|
const root = doc.getMap("map").get("root");
|
||||||
if (root) {
|
if (root) {
|
||||||
root.get("childs")?.forEach((e) => {
|
root.get("childs")?.forEach((e) => {
|
||||||
walk(e);
|
walk(e);
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ export const EdTreeName = ({
|
||||||
p.render();
|
p.render();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<Name name={node.text} is_jsx_prop={is_jsx_prop} />
|
<Name name={node.text} is_jsx_prop={is_jsx_prop} />
|
||||||
<div className={"text-[9px] text-gray-500 -mt-1"}>{node.id} - {item.originalId}</div>
|
{/* <div className={"text-[9px] text-gray-500 -mt-1"}>{node.id} - {item.originalId}</div> */}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ export const compPropVal = (
|
||||||
const prop = props[name] || _prop;
|
const prop = props[name] || _prop;
|
||||||
|
|
||||||
let value: any = null;
|
let value: any = null;
|
||||||
|
|
||||||
if (prop.valueBuilt) {
|
if (prop.valueBuilt) {
|
||||||
const fn = new Function(
|
const fn = new Function(
|
||||||
...Object.keys(args),
|
...Object.keys(args),
|
||||||
|
|
@ -60,9 +61,7 @@ export const compPropVal = (
|
||||||
prop.value
|
prop.value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} else if (prop.meta?.type === "content-element") {
|
||||||
|
|
||||||
if (prop.meta?.type === "content-element") {
|
|
||||||
if (!(typeof value === "object" && !!value && value._jsx)) {
|
if (!(typeof value === "object" && !!value && value._jsx)) {
|
||||||
const id = `${meta.item.id}-${name}`;
|
const id = `${meta.item.id}-${name}`;
|
||||||
if (!jsxProps[id]) {
|
if (!jsxProps[id]) {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ export const jsMount = async (editor: MonacoEditor, monaco: Monaco, p?: PG) => {
|
||||||
let meta = p.page.meta[id];
|
let meta = p.page.meta[id];
|
||||||
if (active.comp_id) {
|
if (active.comp_id) {
|
||||||
meta = p.comp.list[active.comp_id].meta[id];
|
meta = p.comp.list[active.comp_id].meta[id];
|
||||||
if (!meta) return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
active.instance.comp_id = active.comp_id;
|
active.instance.comp_id = active.comp_id;
|
||||||
|
|
@ -81,6 +81,23 @@ export const jsMount = async (editor: MonacoEditor, monaco: Monaco, p?: PG) => {
|
||||||
}
|
}
|
||||||
active.comp_id = comp_id;
|
active.comp_id = comp_id;
|
||||||
} else {
|
} else {
|
||||||
|
if (active.comp_id) {
|
||||||
|
let meta = p.comp.list[active.comp_id].meta[id];
|
||||||
|
|
||||||
|
if (!meta) {
|
||||||
|
const _id = p.comp.list[active.comp_id].doc
|
||||||
|
.getMap("map")
|
||||||
|
.get("root")
|
||||||
|
?.get("id");
|
||||||
|
|
||||||
|
if (_id) {
|
||||||
|
active.item_id = _id;
|
||||||
|
p.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
active.item_id = id;
|
active.item_id = id;
|
||||||
}
|
}
|
||||||
p.render();
|
p.render();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue