wip fix text
This commit is contained in:
parent
742d40f1d5
commit
bd586ce347
|
|
@ -2,6 +2,7 @@ import { IMeta, PG, active } from "../ed-global";
|
|||
|
||||
export const activateMeta = (p: PG, meta: IMeta) => {
|
||||
let parent_comp_id = meta.parent?.comp_id;
|
||||
|
||||
if (
|
||||
active.comp_id &&
|
||||
meta.item.component?.id === active.comp_id &&
|
||||
|
|
@ -103,13 +104,15 @@ export const activateMeta = (p: PG, meta: IMeta) => {
|
|||
} else break;
|
||||
}
|
||||
} else {
|
||||
if (active.item_id !== meta.parent.instance_id) {
|
||||
if (active.item_id !== meta.parent.instance_id && !meta.jsx_prop) {
|
||||
active.item_id = meta.parent.instance_id;
|
||||
} else if (parent.comp_id && meta.item.originalId) {
|
||||
active.instance.comp_id = active.comp_id;
|
||||
active.instance.item_id = active.item_id;
|
||||
active.comp_id = parent.comp_id;
|
||||
active.item_id = meta.item.originalId;
|
||||
} else {
|
||||
active.item_id = meta.item.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const mainPerItemVisit = (
|
|||
prop.contentEditable = true;
|
||||
|
||||
prop.suppressContentEditableWarning = true;
|
||||
if (meta.parent?.comp_id) {
|
||||
if (meta.parent?.comp_id && !meta.jsx_prop) {
|
||||
if (meta.parent.comp_id !== active.comp_id) {
|
||||
prop.contentEditable = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
|
|||
|
||||
if (meta && prop_name) {
|
||||
const props = meta.item.script?.props;
|
||||
|
||||
if (props) {
|
||||
const prop = props[prop_name];
|
||||
if (
|
||||
|
|
@ -49,9 +50,16 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
|
|||
(prop.visible === true || !prop.hasOwnProperty("visible"))
|
||||
) {
|
||||
hide = false;
|
||||
} else {
|
||||
const prop = meta.item.component?.props[prop_name];
|
||||
|
||||
if (prop && (prop.visible || !prop.hasOwnProperty("visible"))) {
|
||||
hide = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const prop = meta.item.component?.props[prop_name];
|
||||
|
||||
if (prop && (prop.visible || !prop.hasOwnProperty("visible"))) {
|
||||
hide = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ export const ViRender: FC<{
|
|||
children?: ReactNode;
|
||||
passprop?: any;
|
||||
}> = ({ meta, children, passprop }) => {
|
||||
|
||||
if (!meta) return null;
|
||||
|
||||
if (meta.item.hidden) return null;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { IMeta } from "../../../ed/logic/ed-global";
|
||||
import { VG } from "../global";
|
||||
import { ViRender } from "../render";
|
||||
import { viScriptArg } from "./arg";
|
||||
|
||||
export const viEvalProps = (
|
||||
|
|
@ -24,6 +25,27 @@ export const viEvalProps = (
|
|||
if (!!meta.item.component.props) {
|
||||
for (const [name, prop] of Object.entries(meta.item.component.props)) {
|
||||
try {
|
||||
if (prop.meta?.type === "content-element") {
|
||||
let val = {
|
||||
_jsx: true,
|
||||
fn: (arg: { passprop: any; meta: any }) => {
|
||||
const id = prop.content?.id;
|
||||
if (id) {
|
||||
const meta = vi.meta[id];
|
||||
return <ViRender meta={meta} passprop={arg.passprop} />;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
arg[name] = val;
|
||||
|
||||
if (passprop) {
|
||||
passprop[name] = val;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const fn = new Function(
|
||||
...Object.keys(arg),
|
||||
`// [${meta.item.name}] ${name}: ${meta.item.id}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,18 @@ export const viEvalScript = (
|
|||
...passprop,
|
||||
};
|
||||
|
||||
if (typeof passprop === "object") {
|
||||
for (const [k, v] of Object.entries(passprop)) {
|
||||
if (typeof v === "object" && (v as any)._jsx) {
|
||||
const jprop = v as unknown as {
|
||||
_jsx: true;
|
||||
fn: (arg: { passprop: any }) => ReactNode;
|
||||
};
|
||||
arg[k] = jprop.fn({ passprop });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fn = new Function(
|
||||
...Object.keys(arg),
|
||||
`// ${meta.item.name}: ${meta.item.id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue