This commit is contained in:
Rizky 2024-07-27 18:13:42 +07:00
parent 86808327ae
commit b127acfd53
1 changed files with 21 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import { jscript } from "../../../../../utils/script/jscript";
import { jsMount } from "../../../../../utils/script/mount"; import { jsMount } from "../../../../../utils/script/mount";
import { monacoTypings } from "../../../../../utils/script/typings"; import { monacoTypings } from "../../../../../utils/script/typings";
import { Loading } from "../../../../../utils/ui/loading"; import { Loading } from "../../../../../utils/ui/loading";
import { getActiveMeta } from "../../../logic/active/get-meta"; import { getActiveMeta, getMetaById } from "../../../logic/active/get-meta";
import { EDGlobal, IMeta, active } from "../../../logic/ed-global"; import { EDGlobal, IMeta, active } from "../../../logic/ed-global";
import { edMonacoDefaultVal } from "./default-val"; import { edMonacoDefaultVal } from "./default-val";
import { declareScope } from "./scope/scope"; import { declareScope } from "./scope/scope";
@ -346,6 +346,7 @@ export const EdScriptMonaco: FC<{}> = () => {
} }
} else { } else {
editorLocalValue[active.item_id] = null; editorLocalValue[active.item_id] = null;
if (mode === "js") {
const code_result = codeEditAdvJs(p, value); const code_result = codeEditAdvJs(p, value);
if (typeof code_result === "string") { if (typeof code_result === "string") {
@ -354,6 +355,19 @@ export const EdScriptMonaco: FC<{}> = () => {
} else if (typeof code_result === "object") { } else if (typeof code_result === "object") {
scope = code_result; scope = code_result;
} }
} else {
const meta = getMetaById(p, active.item_id);
if (meta) {
const madv = meta.mitem?.get("adv");
if (madv) {
if (mode === "css") madv.set("css", value);
else {
madv.set("html", value);
}
}
}
}
} }
if (typeof scope === "object") { if (typeof scope === "object") {
meta.item.script = scope; meta.item.script = scope;