@bhsd/codemirror-mediawiki 2.4.6 → 2.5.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/README.md +25 -1
- package/dist/codemirror.d.ts +8 -1
- package/dist/main.min.js +12 -12
- package/dist/mw.min.js +1 -1
- package/dist/mw.min.js.map +3 -3
- package/i18n/en.json +5 -3
- package/i18n/zh-hans.json +5 -3
- package/i18n/zh-hant.json +5 -3
- package/mw/base.ts +20 -5
- package/mw/config.ts +5 -2
- package/mw/msg.ts +5 -6
- package/mw/textSelection.ts +7 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
- [toggle](#toggle)
|
|
26
26
|
- [update](#update)
|
|
27
27
|
- [Static methods](#static-methods)
|
|
28
|
+
- [getMwConfig](#getmwconfig)
|
|
28
29
|
- [replaceSelections](#replaceselections)
|
|
29
30
|
- [Extensions](#extensions)
|
|
30
31
|
- [allowMultipleSelections](#allowmultipleselections)
|
|
@@ -368,6 +369,23 @@ Refresh linting immediately.
|
|
|
368
369
|
|
|
369
370
|
# Static methods
|
|
370
371
|
|
|
372
|
+
## getMwConfig
|
|
373
|
+
|
|
374
|
+
<details>
|
|
375
|
+
<summary>Expand</summary>
|
|
376
|
+
|
|
377
|
+
*version added: 2.4.7*
|
|
378
|
+
|
|
379
|
+
**param**: [`Config`](https://github.com/bhsd-harry/wikiparser-node/wiki/types#config) the [WikiLint](https://npmjs.com/package/wikilint) configuration
|
|
380
|
+
**returns**: `MwConfig`
|
|
381
|
+
Derive the configuration for the MediaWiki mode from WikiLint configuration.
|
|
382
|
+
|
|
383
|
+
```js
|
|
384
|
+
const mwConfig = CodeMirror6.getMwConfig(config);
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
</details>
|
|
388
|
+
|
|
371
389
|
## replaceSelections
|
|
372
390
|
|
|
373
391
|
<details>
|
|
@@ -375,7 +393,7 @@ Refresh linting immediately.
|
|
|
375
393
|
|
|
376
394
|
*version added: 2.2.2*
|
|
377
395
|
|
|
378
|
-
**param**: [`EditorView`](https://codemirror.net/6/docs/ref/#view.EditorView) the CodeMirror EditorView instance
|
|
396
|
+
**param**: [`EditorView`](https://codemirror.net/6/docs/ref/#view.EditorView) the CodeMirror EditorView instance
|
|
379
397
|
**param**: `(str: string) => string` the replacement function
|
|
380
398
|
Replace the selected text with the return value of the replacement function.
|
|
381
399
|
|
|
@@ -393,6 +411,12 @@ CodeMirror6.replaceSelections(cm.view, str => str.toUpperCase());
|
|
|
393
411
|
|
|
394
412
|
Allow multiple selections.
|
|
395
413
|
|
|
414
|
+
## autocompletion
|
|
415
|
+
|
|
416
|
+
*version added: 2.5.1*
|
|
417
|
+
|
|
418
|
+
Provide autocompletion for the MediaWiki mode.
|
|
419
|
+
|
|
396
420
|
## bracketMatching
|
|
397
421
|
|
|
398
422
|
*version added: 2.0.9*
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import type { KeyBinding } from '@codemirror/view';
|
|
|
3
3
|
import type { Text } from '@codemirror/state';
|
|
4
4
|
import type { SyntaxNode } from '@lezer/common';
|
|
5
5
|
import type { Diagnostic } from '@codemirror/lint';
|
|
6
|
-
|
|
6
|
+
import type { Config } from 'wikilint';
|
|
7
|
+
import type { MwConfig } from './mediawiki';
|
|
8
|
+
export type { MwConfig };
|
|
7
9
|
export type LintSource = (doc: Text) => Diagnostic[] | Promise<Diagnostic[]>;
|
|
8
10
|
export declare const CDN = "https://testingcf.jsdelivr.net";
|
|
9
11
|
export declare class CodeMirror6 {
|
|
@@ -77,4 +79,9 @@ export declare class CodeMirror6 {
|
|
|
77
79
|
* @param func 替换函数
|
|
78
80
|
*/
|
|
79
81
|
static replaceSelections(view: EditorView, func: (str: string) => string): void;
|
|
82
|
+
/**
|
|
83
|
+
* 将wikiparser-node设置转换为codemirror-mediawiki设置
|
|
84
|
+
* @param config
|
|
85
|
+
*/
|
|
86
|
+
static getMwConfig(config: Config): MwConfig;
|
|
80
87
|
}
|