@bhsd/codemirror-mediawiki 2.9.4 → 2.10.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 +4 -3
- package/dist/codemirror.d.ts +2 -1
- package/dist/config.d.ts +89 -0
- package/dist/escape.d.ts +2 -0
- package/dist/fold.d.ts +12 -0
- package/dist/linter.d.ts +33 -0
- package/dist/main.min.js +24 -12
- package/dist/matchTag.d.ts +3 -0
- package/dist/mw.min.js +5 -5
- package/dist/mw.min.js.map +4 -4
- package/dist/plugins.d.ts +6 -0
- package/dist/util.d.ts +7 -0
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/mediawiki.css +8 -8
- package/package.json +13 -10
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
- [replaceSelections](#replaceselections)
|
|
31
31
|
- [Extensions](#extensions)
|
|
32
32
|
- [allowMultipleSelections](#allowmultipleselections)
|
|
33
|
+
- [autocompletion](#autocompletion)
|
|
33
34
|
- [bracketMatching](#bracketmatching)
|
|
34
35
|
- [closeBrackets](#closebrackets)
|
|
35
36
|
- [highlightActiveLine](#highlightactiveline)
|
|
@@ -430,9 +431,9 @@ Allow multiple selections.
|
|
|
430
431
|
|
|
431
432
|
## autocompletion
|
|
432
433
|
|
|
433
|
-
*version added: 2.
|
|
434
|
+
*version added: 2.10.0*
|
|
434
435
|
|
|
435
|
-
Provide autocompletion for
|
|
436
|
+
Provide autocompletion for MediaWiki, CSS and JavaScript modes.
|
|
436
437
|
|
|
437
438
|
## bracketMatching
|
|
438
439
|
|
|
@@ -477,7 +478,7 @@ Key bindings:
|
|
|
477
478
|
|
|
478
479
|
## codeFolding
|
|
479
480
|
|
|
480
|
-
*version added: 2.
|
|
481
|
+
*version added: 2.10.0*
|
|
481
482
|
|
|
482
483
|
Fold template parameters.
|
|
483
484
|
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { CDN } from './util';
|
|
2
3
|
import type { KeyBinding } from '@codemirror/view';
|
|
3
4
|
import type { Text } from '@codemirror/state';
|
|
4
5
|
import type { SyntaxNode } from '@lezer/common';
|
|
@@ -6,9 +7,9 @@ import type { Diagnostic } from '@codemirror/lint';
|
|
|
6
7
|
import type { Config } from 'wikiparser-node';
|
|
7
8
|
import type { MwConfig } from './mediawiki';
|
|
8
9
|
import type { DocRange } from './fold';
|
|
10
|
+
export { CDN };
|
|
9
11
|
export type { MwConfig };
|
|
10
12
|
export type LintSource = (doc: Text) => Diagnostic[] | Promise<Diagnostic[]>;
|
|
11
|
-
export declare const CDN = "https://testingcf.jsdelivr.net";
|
|
12
13
|
/** CodeMirror 6 编辑器 */
|
|
13
14
|
export declare class CodeMirror6 {
|
|
14
15
|
#private;
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author MusikAnimal and others
|
|
3
|
+
* @license GPL-2.0-or-later
|
|
4
|
+
* @see https://gerrit.wikimedia.org/g/mediawiki/extensions/CodeMirror
|
|
5
|
+
*/
|
|
6
|
+
import { Tag } from '@lezer/highlight';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for the MediaWiki highlighting mode for CodeMirror.
|
|
9
|
+
*/
|
|
10
|
+
export declare const modeConfig: {
|
|
11
|
+
/**
|
|
12
|
+
* All HTML/XML tags permitted in MediaWiki Core.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.mediawiki.org/wiki/Extension:CodeMirror#Extension_integration
|
|
15
|
+
*/
|
|
16
|
+
permittedHtmlTags: string[];
|
|
17
|
+
/**
|
|
18
|
+
* HTML tags that are only self-closing.
|
|
19
|
+
*/
|
|
20
|
+
implicitlyClosedHtmlTags: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Mapping of MediaWiki-esque token identifiers to a standardized lezer highlighting tag.
|
|
23
|
+
* Values are one of the default highlighting tags.
|
|
24
|
+
*
|
|
25
|
+
* Once we allow use of other themes, we may want to tweak these values for aesthetic reasons.
|
|
26
|
+
*
|
|
27
|
+
* @see https://lezer.codemirror.net/docs/ref/#highlight.tags
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
tags: {
|
|
31
|
+
apostrophes: string;
|
|
32
|
+
comment: string;
|
|
33
|
+
doubleUnderscore: string;
|
|
34
|
+
extLink: string;
|
|
35
|
+
extLinkBracket: string;
|
|
36
|
+
extLinkProtocol: string;
|
|
37
|
+
extLinkText: string;
|
|
38
|
+
hr: string;
|
|
39
|
+
htmlTagAttribute: string;
|
|
40
|
+
htmlTagBracket: string;
|
|
41
|
+
htmlTagName: string;
|
|
42
|
+
linkBracket: string;
|
|
43
|
+
linkDelimiter: string;
|
|
44
|
+
linkText: string;
|
|
45
|
+
linkToSection: string;
|
|
46
|
+
list: string;
|
|
47
|
+
parserFunction: string;
|
|
48
|
+
parserFunctionBracket: string;
|
|
49
|
+
parserFunctionDelimiter: string;
|
|
50
|
+
parserFunctionName: string;
|
|
51
|
+
sectionHeader: string;
|
|
52
|
+
signature: string;
|
|
53
|
+
tableBracket: string;
|
|
54
|
+
tableDefinition: string;
|
|
55
|
+
tableDelimiter: string;
|
|
56
|
+
template: string;
|
|
57
|
+
templateArgumentName: string;
|
|
58
|
+
templateBracket: string;
|
|
59
|
+
templateDelimiter: string;
|
|
60
|
+
templateName: string;
|
|
61
|
+
templateVariable: string;
|
|
62
|
+
templateVariableBracket: string;
|
|
63
|
+
templateVariableName: string;
|
|
64
|
+
section: string;
|
|
65
|
+
em: string;
|
|
66
|
+
error: string;
|
|
67
|
+
extTag: string;
|
|
68
|
+
extTagAttribute: string;
|
|
69
|
+
extTagBracket: string;
|
|
70
|
+
extTagName: string;
|
|
71
|
+
freeExtLink: string;
|
|
72
|
+
freeExtLinkProtocol: string;
|
|
73
|
+
htmlEntity: string;
|
|
74
|
+
linkPageName: string;
|
|
75
|
+
pageName: string;
|
|
76
|
+
skipFormatting: string;
|
|
77
|
+
strong: string;
|
|
78
|
+
tableCaption: string;
|
|
79
|
+
templateVariableDelimiter: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* These are custom tokens (a.k.a. tags) that aren't mapped to any of the standardized tags.
|
|
83
|
+
*
|
|
84
|
+
* @todo pass parent Tags in Tag.define() where appropriate for better theming.
|
|
85
|
+
* @see https://codemirror.net/docs/ref/#language.StreamParser.tokenTable
|
|
86
|
+
* @see https://lezer.codemirror.net/docs/ref/#highlight.Tag%5Edefine
|
|
87
|
+
*/
|
|
88
|
+
readonly tokenTable: Record<string, Tag>;
|
|
89
|
+
};
|
package/dist/escape.d.ts
ADDED
package/dist/fold.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorView } from '@codemirror/view';
|
|
2
|
+
import type { Extension } from '@codemirror/state';
|
|
3
|
+
export interface DocRange {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const foldExtension: Extension;
|
|
8
|
+
/**
|
|
9
|
+
* 点击提示折叠模板参数
|
|
10
|
+
* @param view
|
|
11
|
+
*/
|
|
12
|
+
export declare const foldHandler: (view: EditorView) => (e: MouseEvent) => void;
|
package/dist/linter.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LinterBase } from 'wikiparser-node/extensions/typings';
|
|
2
|
+
import type { Linter } from 'eslint';
|
|
3
|
+
import type { Warning } from 'stylelint';
|
|
4
|
+
import type { Diagnostic } from '@codemirror/lint';
|
|
5
|
+
declare type getLinter<T> = (opt?: Record<string, unknown>) => T;
|
|
6
|
+
declare type getAsyncLinter<T> = (opt?: Record<string, unknown>) => Promise<T>;
|
|
7
|
+
/**
|
|
8
|
+
* 获取 WikiLint
|
|
9
|
+
* @param opt 选项
|
|
10
|
+
*/
|
|
11
|
+
export declare const getWikiLinter: getAsyncLinter<LinterBase>;
|
|
12
|
+
/**
|
|
13
|
+
* 获取 ESLint
|
|
14
|
+
* @param opt 选项
|
|
15
|
+
*/
|
|
16
|
+
export declare const getJsLinter: getAsyncLinter<(text: string) => Linter.LintMessage[]>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取 Stylelint
|
|
19
|
+
* @param opt 选项
|
|
20
|
+
*/
|
|
21
|
+
export declare const getCssLinter: getAsyncLinter<(text: string) => Promise<Warning[]>>;
|
|
22
|
+
/** 获取 luaparse */
|
|
23
|
+
export declare const getLuaLinter: getAsyncLinter<(text: string) => Diagnostic[]>;
|
|
24
|
+
declare interface JsonError {
|
|
25
|
+
message: string;
|
|
26
|
+
severity: 'error';
|
|
27
|
+
line: string | undefined;
|
|
28
|
+
column: string | undefined;
|
|
29
|
+
position: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** JSON.parse */
|
|
32
|
+
export declare const getJsonLinter: getLinter<(text: string) => JsonError[]>;
|
|
33
|
+
export {};
|