From 70b17dc2c0a65976c4b0829fcadf9bfb2bb20c36 Mon Sep 17 00:00:00 2001 From: bhsd <2545473905@qq.com> Date: Thu, 25 Apr 2024 15:36:47 +0800 Subject: [PATCH] fix: load latest lib versions --- src/index.d.ts | 11 ----------- src/main.ts | 11 +++++++++-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index ce0a47d..968bf7b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -15,17 +15,6 @@ type MonacoOrPromise = MonacoEditor | Promise; type CodeMirrorOrPromise = CodeMirror | Promise; declare global { - namespace mw { - const libs: { - wphl?: { - version?: string; - cmVersion: string; - monacoVersion: string; - useMonaco?: boolean; - }; - }; - } - interface Window { MonacoWikiEditor: MonacoOrPromise | undefined; CodeMirror6: CodeMirrorOrPromise | undefined; diff --git a/src/main.ts b/src/main.ts index bf20247..aa995f1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,14 +4,21 @@ * @license GPL-3.0 */ +declare interface WPHL { + version?: string; + cmVersion?: string; + monacoVersion?: string; + useMonaco?: boolean; +} + ((): void => { - const {libs} = mw, + const {libs} = mw as {libs: {wphl?: WPHL}}, {wphl} = libs; if (wphl?.version) { return; } const version = '3.1.0'; - libs.wphl = {version, cmVersion: '2.9', monacoVersion: '0.2.2', ...wphl}; // 开始加载 + libs.wphl = {version, ...wphl}; // 开始加载 // 路径 const CDN = '//testingcf.jsdelivr.net',