@bhsd/codemirror-mediawiki 3.4.2 → 3.5.0
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/README.md +0 -1
- package/dist/codemirror.d.ts +2 -2
- package/dist/codemirror.js +6 -5
- package/dist/html.js +3 -3
- package/dist/lintsource.d.ts +2 -0
- package/dist/main.min.js +23 -23
- package/dist/mediawiki.d.ts +1 -0
- package/dist/mediawiki.js +7 -7
- package/dist/mw.min.js +27 -27
- package/dist/static.d.ts +2 -0
- package/dist/static.js +2 -0
- package/dist/token.js +12 -3
- 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 +3 -3
package/README.md
CHANGED
|
@@ -1221,7 +1221,6 @@ registerSignatureHelp();
|
|
|
1221
1221
|
|
|
1222
1222
|
### Extension
|
|
1223
1223
|
|
|
1224
|
-
1. [Extension:Translate](https://www.mediawiki.org/wiki/Extension:Translate) is not supported.
|
|
1225
1224
|
1. [Extension:Poem](https://www.mediawiki.org/wiki/Extension:Poem) should prevent preformatted text ([Example](http://bhsd-harry.github.io/monaco-wiki/tests.html#%3Cpoem%3E%20with%20leading%20whitespace)).
|
|
1226
1225
|
|
|
1227
1226
|
### Transclusion
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { ConfigData } from 'wikiparser-node';
|
|
|
6
6
|
import type { MwConfig } from './token';
|
|
7
7
|
import type { DocRange, foldHandler } from './fold';
|
|
8
8
|
import type { Option, LiveOption } from './linter';
|
|
9
|
-
import type { LintSource, LintSourceGetter } from './lintsource';
|
|
9
|
+
import type { LintSource, LintSources, LintSourceGetter } from './lintsource';
|
|
10
10
|
import type { detectIndent } from './indent';
|
|
11
11
|
import type statusBar from './statusBar';
|
|
12
12
|
export type AddonMain<T> = (config?: T, cm?: CodeMirror6) => Extension;
|
|
@@ -67,7 +67,7 @@ export declare class CodeMirror6 {
|
|
|
67
67
|
* Start syntax checking
|
|
68
68
|
* @param lintSource function for syntax checking
|
|
69
69
|
*/
|
|
70
|
-
lint(lintSource?:
|
|
70
|
+
lint(lintSource?: LintSources): void;
|
|
71
71
|
/** Update syntax checking immediately */
|
|
72
72
|
update(): void;
|
|
73
73
|
/**
|
package/dist/codemirror.js
CHANGED
|
@@ -225,20 +225,21 @@ export class CodeMirror6 {
|
|
|
225
225
|
* @param lintSource function for syntax checking
|
|
226
226
|
*/
|
|
227
227
|
lint(lintSource) {
|
|
228
|
-
const
|
|
228
|
+
const lintSources = typeof lintSource === 'function' ? [lintSource] : lintSource;
|
|
229
|
+
const linterExtension = lintSources
|
|
229
230
|
? [
|
|
230
|
-
linter(async ({ state }) => {
|
|
231
|
-
const diagnostics = await
|
|
231
|
+
...lintSources.map(source => linter(async ({ state }) => {
|
|
232
|
+
const diagnostics = await source(state);
|
|
232
233
|
if (state.readOnly) {
|
|
233
234
|
for (const diagnostic of diagnostics) {
|
|
234
235
|
delete diagnostic.actions;
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
return diagnostics;
|
|
238
|
-
}),
|
|
239
|
+
}, source.delay ? { delay: source.delay } : undefined)),
|
|
239
240
|
lintGutter(),
|
|
240
241
|
keymap.of(lintKeymap),
|
|
241
|
-
optionalFunctions.statusBar(this,
|
|
242
|
+
optionalFunctions.statusBar(this, lintSources[0].fixer),
|
|
242
243
|
]
|
|
243
244
|
: [];
|
|
244
245
|
if (lintSource) {
|
package/dist/html.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { configureNesting } from '@lezer/html';
|
|
2
|
-
import {
|
|
2
|
+
import { htmlLanguage, htmlCompletionSourceWith } from '@codemirror/lang-html';
|
|
3
3
|
import { javascript, javascriptLanguage } from '@codemirror/lang-javascript';
|
|
4
4
|
import { cssLanguage } from '@codemirror/lang-css';
|
|
5
5
|
import { LanguageSupport } from '@codemirror/language';
|
|
@@ -7,14 +7,14 @@ import { jsCompletion } from './javascript';
|
|
|
7
7
|
import { mediawiki } from './mediawiki';
|
|
8
8
|
import { cssCompletion } from './css';
|
|
9
9
|
export default (config) => {
|
|
10
|
-
const { language, support } = mediawiki(config), lang = new LanguageSupport(
|
|
10
|
+
const { language, support } = mediawiki(config), lang = new LanguageSupport(htmlLanguage.configure({
|
|
11
11
|
wrap: configureNesting([
|
|
12
12
|
{ tag: 'script', parser: javascriptLanguage.parser },
|
|
13
13
|
{ tag: 'style', parser: cssLanguage.parser },
|
|
14
14
|
{ tag: 'noinclude', parser: language.parser },
|
|
15
15
|
], [{ name: 'style', parser: cssLanguage.parser.configure({ top: 'Styles' }) }]),
|
|
16
16
|
}), [
|
|
17
|
-
|
|
17
|
+
htmlLanguage.data.of({
|
|
18
18
|
autocomplete: htmlCompletionSourceWith({
|
|
19
19
|
extraTags: {
|
|
20
20
|
noinclude: { globalAttrs: false },
|
package/dist/lintsource.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ import type { Language } from '@codemirror/language';
|
|
|
4
4
|
import type { Diagnostic } from '@codemirror/lint';
|
|
5
5
|
import type { Option, LiveOption } from './linter';
|
|
6
6
|
export type LintSource = ((state: EditorState) => Diagnostic[] | Promise<Diagnostic[]>) & {
|
|
7
|
+
delay?: number;
|
|
7
8
|
fixer?: (doc: Text, rule?: string) => string | Promise<string>;
|
|
8
9
|
};
|
|
10
|
+
export type LintSources = LintSource | [LintSource] | [LintSource, LintSource];
|
|
9
11
|
export type LintSourceGetter = (opt?: Option | LiveOption, view?: EditorView, nestedMWLanguage?: Language) => LintSource | Promise<LintSource>;
|
|
10
12
|
export declare const getWikiLintSource: LintSourceGetter;
|
|
11
13
|
export declare const getJsLintSource: LintSourceGetter;
|