From 07be5165abda48761efcba15560f06af4ec77413 Mon Sep 17 00:00:00 2001 From: Bhsd <55071315+bhsd-harry@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:16:31 +0800 Subject: [PATCH] Update MediaWiki:Gadget-wikieditor-highlight.js (#412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update MediaWiki:Gadget-wikieditor-highlight.js 大更新 * Update MediaWiki:Gadget-wikieditor-highlight.js 让用户自行选择加载的插件 --- .../MediaWiki:Gadget-wikieditor-highlight.js | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/gadgets/wikieditor-highlight/MediaWiki:Gadget-wikieditor-highlight.js b/src/gadgets/wikieditor-highlight/MediaWiki:Gadget-wikieditor-highlight.js index fabeb9bb..2fb9df25 100644 --- a/src/gadgets/wikieditor-highlight/MediaWiki:Gadget-wikieditor-highlight.js +++ b/src/gadgets/wikieditor-highlight/MediaWiki:Gadget-wikieditor-highlight.js @@ -18,27 +18,11 @@ const script = document.createElement("script"); script.addEventListener("load", resolve); script.type = "module"; - script.src = "https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki/mw/dist/base.js"; + script.src = "https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki/dist/mw.min.js"; document.head.append(script); }); } - cm = await window.CodeMirror6.fromTextArea($textarea[0], lang); - cm.prefer([ - "highlightSpecialChars", - "highlightActiveLine", - "bracketMatching", - "closeBrackets", - "allowMultipleSelections", - ]); - const [config] = await Promise.all([ - libCachedCode.getCachedCode("https://testingcf.jsdelivr.net/npm/wikiparser-node/config/moegirl.json"), - cm.defaultLint(true, { include: [2, 10, 828].includes(ns) }), - ]); - try { - window.wikiparse?.setConfig(JSON.parse(config)); - } catch (e) { - console.error(e); - } + window.CodeMirror6.fromTextArea($textarea[0], lang, ns); }; if (!isAdvanced) { init();