From dd3b1b4f9012eecd52f5f27d8f6f4fb24c9888c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Mon, 8 Jul 2024 15:55:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=88=A0?= =?UTF-8?q?=E9=99=A4Userconfig=E5=90=8E=E4=B8=BB=E9=A1=B5=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E4=BC=9A=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#285?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/service/script/event.ts | 4 ++++ src/pages/options/routes/script/ScriptEditor.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/service/script/event.ts b/src/app/service/script/event.ts index 86b386aa..923e5d38 100644 --- a/src/app/service/script/event.ts +++ b/src/app/service/script/event.ts @@ -68,6 +68,10 @@ export default class ScriptEventListener { script.selfMetadata = oldScript.selfMetadata; } } + // 判断一些undefined的字段 + if (!script.config) { + script.config = undefined; + } return new Promise((resolve, reject) => { this.dao.save(script).then( () => { diff --git a/src/pages/options/routes/script/ScriptEditor.tsx b/src/pages/options/routes/script/ScriptEditor.tsx index fc83889d..8ff1a984 100644 --- a/src/pages/options/routes/script/ScriptEditor.tsx +++ b/src/pages/options/routes/script/ScriptEditor.tsx @@ -150,7 +150,7 @@ const emptyScript = async (template: string, hotKeys: any, target?: string) => { type visibleItem = "scriptStorage" | "scriptSetting" | "scriptResource"; const popstate = () => { - // eslint-disable-next-line no-restricted-globals + // eslint-disable-next-line no-restricted-globals, no-alert if (confirm("脚本已修改, 离开后会丢失修改, 是否继续?")) { window.history.back(); window.removeEventListener("popstate", popstate);