@bhsd/codemirror-mediawiki 3.7.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codemirror.d.ts +2 -1
- package/dist/codemirror.js +6 -6
- package/dist/main.min.js +18 -18
- package/dist/mw.min.js +27 -27
- package/dist/wiki.min.js +26 -26
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +2 -2
package/dist/codemirror.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { EditorView } from '@codemirror/view';
|
|
|
2
2
|
import type { KeyBinding } from '@codemirror/view';
|
|
3
3
|
import type { Extension } from '@codemirror/state';
|
|
4
4
|
import type { SyntaxNode } from '@lezer/common';
|
|
5
|
+
import type { ConfigGetter } from '@bhsd/browser';
|
|
5
6
|
import type { ConfigData } from 'wikiparser-node';
|
|
6
7
|
import type { DocRange, foldHandler } from './fold';
|
|
7
8
|
import type { detectIndent } from './indent';
|
|
@@ -36,7 +37,7 @@ export declare class CodeMirror6 {
|
|
|
36
37
|
#private;
|
|
37
38
|
/** only for sanitized-css */
|
|
38
39
|
dialect: Dialect;
|
|
39
|
-
getWikiConfig?:
|
|
40
|
+
getWikiConfig?: ConfigGetter;
|
|
40
41
|
langConfig: MwConfig | undefined;
|
|
41
42
|
/** textarea element */
|
|
42
43
|
get textarea(): HTMLTextAreaElement;
|
package/dist/codemirror.js
CHANGED
|
@@ -97,7 +97,7 @@ export class CodeMirror6 {
|
|
|
97
97
|
let timer;
|
|
98
98
|
const { textarea, lang } = this, { value, dir: d, accessKey, tabIndex, lang: l, readOnly } = textarea, extensions = [
|
|
99
99
|
this.#language.of(this.#getLanguage(config)),
|
|
100
|
-
this.#linter.of(linters[lang] ?? []),
|
|
100
|
+
this.#linter.of(linters[lang]?.(this) ?? []),
|
|
101
101
|
this.#extensions.of([]),
|
|
102
102
|
this.#dir.of(EditorView.editorAttributes.of({ dir: d })),
|
|
103
103
|
this.#extraKeys.of([]),
|
|
@@ -219,9 +219,9 @@ export class CodeMirror6 {
|
|
|
219
219
|
const ext = this.#getLanguage(config);
|
|
220
220
|
this.#effects([
|
|
221
221
|
this.#language.reconfigure(ext),
|
|
222
|
-
this.#linter.reconfigure(linters[lang] ?? []),
|
|
222
|
+
this.#linter.reconfigure(linters[lang]?.(this) ?? []),
|
|
223
223
|
]);
|
|
224
|
-
this.#minHeight(
|
|
224
|
+
this.#minHeight(lang in linters);
|
|
225
225
|
this.prefer({});
|
|
226
226
|
}
|
|
227
227
|
}
|
|
@@ -231,7 +231,7 @@ export class CodeMirror6 {
|
|
|
231
231
|
*/
|
|
232
232
|
lint(lintSource) {
|
|
233
233
|
const lintSources = typeof lintSource === 'function' ? [lintSource] : lintSource;
|
|
234
|
-
const linterExtension = lintSources
|
|
234
|
+
const linterExtension = (cm) => lintSources
|
|
235
235
|
? [
|
|
236
236
|
...lintSources.map(source => linter(async ({ state }) => {
|
|
237
237
|
const diagnostics = (await source(state)).map((diagnostic) => ({
|
|
@@ -256,7 +256,7 @@ export class CodeMirror6 {
|
|
|
256
256
|
})),
|
|
257
257
|
lintGutter(),
|
|
258
258
|
keymap.of(lintKeymap),
|
|
259
|
-
optionalFunctions.statusBar(
|
|
259
|
+
optionalFunctions.statusBar(cm, lintSources[0].fixer),
|
|
260
260
|
]
|
|
261
261
|
: [];
|
|
262
262
|
if (lintSource) {
|
|
@@ -266,7 +266,7 @@ export class CodeMirror6 {
|
|
|
266
266
|
delete linters[this.#lang];
|
|
267
267
|
}
|
|
268
268
|
if (this.#view) {
|
|
269
|
-
this.#effects(this.#linter.reconfigure(linterExtension));
|
|
269
|
+
this.#effects(this.#linter.reconfigure(linterExtension(this)));
|
|
270
270
|
this.#minHeight(Boolean(lintSource));
|
|
271
271
|
}
|
|
272
272
|
}
|