wip fix
This commit is contained in:
parent
d148e20d2c
commit
cda1a66c60
|
|
@ -111,9 +111,9 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return jscript
|
return jscript;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.log('e', e)
|
console.log("e", e);
|
||||||
return e.message.toString();
|
return e.message.toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -173,10 +173,10 @@ export const code_edit: SAction["code"]["edit"] = async function (
|
||||||
const res =
|
const res =
|
||||||
prop_kind !== "typings"
|
prop_kind !== "typings"
|
||||||
? await transform(`return ${src}`, {
|
? await transform(`return ${src}`, {
|
||||||
jsx: "transform",
|
jsx: "transform",
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
loader: "tsx",
|
loader: "tsx",
|
||||||
})
|
})
|
||||||
: { code: src };
|
: { code: src };
|
||||||
doc?.transact(() => {
|
doc?.transact(() => {
|
||||||
if (prop_kind === "value") {
|
if (prop_kind === "value") {
|
||||||
|
|
@ -219,35 +219,37 @@ const findId = (mitem: MContent | MRoot, id: string) => {
|
||||||
let found: null | MItem = null;
|
let found: null | MItem = null;
|
||||||
|
|
||||||
const m = mitem as MItem;
|
const m = mitem as MItem;
|
||||||
if (m.get("id") === id) {
|
if (m) {
|
||||||
return m;
|
if (m.get("id") === id) {
|
||||||
}
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
const childs = m.get("childs");
|
const childs = m.get("childs");
|
||||||
if (childs) {
|
if (childs) {
|
||||||
childs.forEach((child) => {
|
childs.forEach((child) => {
|
||||||
const f = findId(child, id);
|
const f = findId(child, id);
|
||||||
if (f) {
|
if (f) {
|
||||||
found = f;
|
found = f;
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
const mprops = m.get("component")?.get("props");
|
|
||||||
|
|
||||||
if (mprops) {
|
|
||||||
mprops.forEach((mprop) => {
|
|
||||||
const mcontent = mprop.get("content");
|
|
||||||
if (mcontent) {
|
|
||||||
const f = findId(mcontent, id);
|
|
||||||
if (f) {
|
|
||||||
found = f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (found) return found;
|
if (!found) {
|
||||||
|
const mprops = m.get("component")?.get("props");
|
||||||
|
|
||||||
|
if (mprops) {
|
||||||
|
mprops.forEach((mprop) => {
|
||||||
|
const mcontent = mprop.get("content");
|
||||||
|
if (mcontent) {
|
||||||
|
const f = findId(mcontent, id);
|
||||||
|
if (f) {
|
||||||
|
found = f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found) return found;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue