Skip to content

Commit

Permalink
fix: types declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-fish committed Mar 8, 2024
1 parent 4b31291 commit 39ad73e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/plugins/monaco/env.d.ts
Original file line number Diff line number Diff line change
@@ -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
}
}
8 changes: 4 additions & 4 deletions src/plugins/monaco/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
* @license MIT
*/
mw.hook('InPageEdit.quickEdit').add(
/**
* hook payload
* @param {{ $editArea: JQuery<HTMLTextAreaElement>; $modalContent: JQuery<HTMLElement>; $modalTitle: JQuery<HTMLElement> }} 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()
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 39ad73e

Please sign in to comment.