This commit is contained in:
Rizky 2024-03-30 13:20:27 +07:00
parent b14fb4d67e
commit 09d4222c11
2 changed files with 20 additions and 5 deletions

View File

@ -196,6 +196,7 @@ export const EdPopComp = () => {
placeholder="Search" placeholder="Search"
spellCheck={false} spellCheck={false}
className="my-1 bg-transparent bg-white border outline-none px-1 focus:border-blue-500 focus:w-[300px] transition-all" className="my-1 bg-transparent bg-white border outline-none px-1 focus:border-blue-500 focus:w-[300px] transition-all"
autoFocus
value={compPicker.search} value={compPicker.search}
onChange={(e) => { onChange={(e) => {
compPicker.search = e.currentTarget.value; compPicker.search = e.currentTarget.value;

View File

@ -2,7 +2,7 @@ import { FC, useEffect } from "react";
import { useGlobal, useLocal } from "web-utils"; import { useGlobal, useLocal } from "web-utils";
import { TypedMap } from "yjs-types"; import { TypedMap } from "yjs-types";
import { FMCompDef, FNCompDef } from "../../../../../utils/types/meta-fn"; import { FMCompDef, FNCompDef } from "../../../../../utils/types/meta-fn";
import { EDGlobal, IMeta } from "../../../logic/ed-global"; import { EDGlobal, IMeta, active } from "../../../logic/ed-global";
import { treeRebuild } from "../../../logic/tree/build"; import { treeRebuild } from "../../../logic/tree/build";
import { EdPropLabel } from "./prop-label"; import { EdPropLabel } from "./prop-label";
@ -27,11 +27,25 @@ export const EdPropInstanceButton: FC<{
timeout: null as any, timeout: null as any,
}); });
useEffect(() => { useEffect(() => {
return () => { const arg: any = { ...active.scope };
delete w.prop_buttons; if (meta.item.script?.props) {
}; for (const [k, v] of Object.entries(meta.item.script?.props)) {
eval(`arg.${k} = ${v.value}`);
}
} else if (meta.item.component) {
for (const [k, v] of Object.entries(meta.item.component.props)) {
eval(`arg.${k} = ${v.valueBuilt}`);
}
}
const btn_fn = new Function(
...Object.keys(arg),
`return ${cprop.valueBuilt}`
);
local.value = btn_fn(...Object.values(arg));
local.render();
}, []); }, []);
const props = mprop.parent?.toJSON(); const props = mprop.parent?.toJSON();