diff --git a/src/plugins/monaco/env.d.ts b/src/plugins/monaco/env.d.ts index 92e2d70..6d7807b 100644 --- a/src/plugins/monaco/env.d.ts +++ b/src/plugins/monaco/env.d.ts @@ -1,8 +1,10 @@ -import monaco from 'monaco-editor' - -// declare const monaco: typeof monaco +import MonacoEditor from 'monaco-editor' declare global { - const monaco: typeof monaco - const MonacoEnvironment: monaco.Environment + const monaco: typeof MonacoEditor + let MonacoEnvironment: MonacoEditor.Environment + interface Window { + monaco: typeof MonacoEditor + MonacoEditor: typeof MonacoEditor + } } diff --git a/src/plugins/monaco/script.js b/src/plugins/monaco/script.js index 93d7a53..f56ee98 100644 --- a/src/plugins/monaco/script.js +++ b/src/plugins/monaco/script.js @@ -4,11 +4,14 @@ * @license MIT */ mw.hook('InPageEdit.quickEdit').add( + /** + * hook payload + * @param {{ $editArea: JQuery; $modalContent: JQuery; $modalTitle: JQuery }} param0 + */ ({ $editArea, $modalContent, $modalTitle }) => { ;(async () => { await mw.loader.using(['mediawiki.Title', 'mediawiki.util']) - /** @type {HTMLTextAreaElement} */ const textarea = $editArea.get(0) const language = getLangFromContentModel( $modalTitle.find('.editPage').text() @@ -79,9 +82,6 @@ importScripts('${MONACO_CDN_BASE}/vs/${path}') }, }) require(['vs/editor/editor.main'], () => { - /** - * @type {import('monaco-editor')} - */ const monaco = window.monaco mw.hook('InPageEdit.monaco').fire(monaco)