fix instance

This commit is contained in:
Rizky 2024-08-02 10:34:36 +07:00
parent c3be80b2e9
commit 897b5fbe06
3 changed files with 18 additions and 6 deletions

View File

@ -89,7 +89,10 @@ export const EdSidePropInstance: FC<{ meta: IMeta }> = ({ meta }) => {
for (const [k, v] of Object.entries(meta.item.script?.props)) { for (const [k, v] of Object.entries(meta.item.script?.props)) {
if (v.value && v.value.length > 3) { if (v.value && v.value.length > 3) {
try { try {
const evn = new Function("arg", `arg["${k}"] = ${v.value}`); const evn = new Function(
"arg",
`arg["${k}"] = (() => { ${v.value} })()`
);
evn(arg); evn(arg);
} catch (e) {} } catch (e) {}
} }
@ -100,7 +103,7 @@ export const EdSidePropInstance: FC<{ meta: IMeta }> = ({ meta }) => {
try { try {
const evn = new Function( const evn = new Function(
"arg", "arg",
`arg["${k}"] = ${v.valueBuilt}` `arg["${k}"] = (() => { ${v.valueBuilt} })()`
); );
evn(arg); evn(arg);
} catch (e) { } catch (e) {

View File

@ -34,7 +34,10 @@ export const EdPropInstanceButton: FC<{
for (const [k, v] of Object.entries(meta.item.script?.props)) { for (const [k, v] of Object.entries(meta.item.script?.props)) {
if (v.value && v.value.length > 3) { if (v.value && v.value.length > 3) {
try { try {
const evn = new Function("arg", `arg["${k}"] = ${v.value}`); const evn = new Function(
"arg",
`arg["${k}"] = (() => { ${v.value} })()`
);
evn(arg); evn(arg);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -46,7 +49,10 @@ export const EdPropInstanceButton: FC<{
for (const [k, v] of Object.entries(meta.item.component.props)) { for (const [k, v] of Object.entries(meta.item.component.props)) {
if (v.valueBuilt && v.valueBuilt.length > 3) { if (v.valueBuilt && v.valueBuilt.length > 3) {
try { try {
const evn = new Function("arg", `arg["${k}"] = ${v.valueBuilt}`); const evn = new Function(
"arg",
`arg["${k}"] = (() => { ${v.valueBuilt} })()`
);
evn(arg); evn(arg);
} catch (e) { } catch (e) {
console.error(e); console.error(e);

View File

@ -83,7 +83,10 @@ export const EdPropInstanceOptions: FC<{
for (const [k, v] of Object.entries(meta.item.script?.props)) { for (const [k, v] of Object.entries(meta.item.script?.props)) {
if (v.value && v.value.length > 3) { if (v.value && v.value.length > 3) {
try { try {
const evn = new Function("arg", `arg["${k}"] = ${v.value}`); const evn = new Function(
"arg",
`arg["${k}"] = (() => { ${v.value} })()`
);
evn(arg); evn(arg);
} catch (e) {} } catch (e) {}
} }
@ -95,7 +98,7 @@ export const EdPropInstanceOptions: FC<{
try { try {
const evn = new Function( const evn = new Function(
"arg", "arg",
`arg["${k}"] = ${v.valueBuilt}` `arg["${k}"] = (() => { ${v.valueBuilt} })()`
); );
evn(arg); evn(arg);
} catch (e) { } catch (e) {