@bhsd/codemirror-mediawiki 2.11.3 → 2.12.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 CHANGED
@@ -41,7 +41,6 @@
41
41
  - [escape](#escape)
42
42
  - [codeFolding](#codefolding)
43
43
  - [tagMatching](#tagmatching)
44
- - [useMonaco](#usemonaco)
45
44
 
46
45
  </details>
47
46
 
@@ -159,7 +158,7 @@ Whether the editor is visible, read-only.
159
158
  *version added: 2.2.2*
160
159
 
161
160
  **param**: [`KeyBinding[]`](https://codemirror.net/docs/ref/#view.KeyBinding) the extra key bindings
162
- Add extra key bindings.
161
+ Add extra key bindings. Need initialization first.
163
162
 
164
163
  ```js
165
164
  cm.extraKeys([
@@ -316,7 +315,7 @@ cm.prefer({
316
315
  *version added: 2.6.2*
317
316
 
318
317
  **param**: [`number | {anchor: number, head: number}`](https://codemirror.net/docs/ref/#state.SelectionRange.anchor) the position or range to scroll to, default as the current cursor position
319
- Scroll to the given position or range.
318
+ Scroll to the given position or range. Need initialization first.
320
319
 
321
320
  ```js
322
321
  cm.scrollTo();
@@ -332,7 +331,7 @@ cm.scrollTo();
332
331
  *version added: 2.1.8*
333
332
 
334
333
  **param**: `string` new content
335
- Reset the content of the editor.
334
+ Reset the content of the editor. Need initialization first.
336
335
 
337
336
  ```js
338
337
  cm.setContent('');
@@ -385,7 +384,7 @@ cm.setLanguage('lua');
385
384
  *version added: 2.1.3*
386
385
 
387
386
  **param**: `boolean` whether to show the editor, optional
388
- Switch between the CodeMirror editor and the native textarea.
387
+ Switch between the CodeMirror editor and the native textarea. Need initialization first.
389
388
 
390
389
  ```js
391
390
  cm.toggle();
@@ -450,7 +449,7 @@ Allow multiple selections.
450
449
 
451
450
  ## autocompletion
452
451
 
453
- *version added: 2.10.0*
452
+ *version added: 2.5.1*
454
453
 
455
454
  Provide autocompletion for MediaWiki, CSS and JavaScript modes.
456
455
 
@@ -497,25 +496,19 @@ Key bindings:
497
496
 
498
497
  ## codeFolding
499
498
 
500
- *version added: 2.10.0*
499
+ *version added: 2.3.0*
501
500
 
502
- Fold template parameters.
501
+ Fold templates, parser functions and extension tags in the MediaWiki mode, and code blocks in other modes.
503
502
 
504
503
  Key bindings:
505
504
 
506
- - `Ctrl` + `Shift` + `[`/`Cmd` + `Alt` + `[`: Fold the selected templates
507
- - `Ctrl` + `Shift` + `]`/`Cmd` + `Alt` + `]`: Unfold the selected templates
508
- - `Ctrl` + `Alt` + `[`: Fold all templates
509
- - `Ctrl` + `Alt` + `]`: Unfold all templates
505
+ - `Ctrl` + `Shift` + `[`/`Cmd` + `Alt` + `[`: Fold at the selected text
506
+ - `Ctrl` + `Shift` + `]`/`Cmd` + `Alt` + `]`: Unfold at the selected text
507
+ - `Ctrl` + `Alt` + `[`: Fold all
508
+ - `Ctrl` + `Alt` + `]`: Unfold all
510
509
 
511
510
  ## tagMatching
512
511
 
513
512
  *version added: 2.4.1*
514
513
 
515
514
  Matched or unmatched tags are highlighted in cyan or dark red when the cursor is inside.
516
-
517
- ## useMonaco
518
-
519
- *version added: 2.11.1*
520
-
521
- Use the Monaco editor instead of the CodeMirror editor.
@@ -21,6 +21,7 @@ export declare class CodeMirror6 {
21
21
  * @param textarea 文本框
22
22
  * @param lang 语言
23
23
  * @param config 语言设置
24
+ * @param init 是否初始化
24
25
  */
25
26
  constructor(textarea: HTMLTextAreaElement, lang?: string, config?: unknown, init?: boolean);
26
27
  /**
package/dist/config.d.ts CHANGED
@@ -7,17 +7,17 @@ import { Tag } from '@lezer/highlight';
7
7
  /**
8
8
  * Configuration for the MediaWiki highlighting mode for CodeMirror.
9
9
  */
10
- export declare const modeConfig: {
10
+ declare const modeConfig: {
11
11
  /**
12
12
  * All HTML/XML tags permitted in MediaWiki Core.
13
13
  *
14
14
  * @see https://www.mediawiki.org/wiki/Extension:CodeMirror#Extension_integration
15
15
  */
16
- permittedHtmlTags: string[];
16
+ htmlTags: string[];
17
17
  /**
18
18
  * HTML tags that are only self-closing.
19
19
  */
20
- implicitlyClosedHtmlTags: string[];
20
+ voidHtmlTags: string[];
21
21
  /**
22
22
  * Mapping of MediaWiki-esque token identifiers to a standardized lezer highlighting tag.
23
23
  * Values are one of the default highlighting tags.
@@ -27,7 +27,7 @@ export declare const modeConfig: {
27
27
  * @see https://lezer.codemirror.net/docs/ref/#highlight.tags
28
28
  * @internal
29
29
  */
30
- tags: {
30
+ tokens: {
31
31
  apostrophes: string;
32
32
  comment: string;
33
33
  doubleUnderscore: string;
@@ -87,3 +87,4 @@ export declare const modeConfig: {
87
87
  */
88
88
  readonly tokenTable: Record<string, Tag>;
89
89
  };
90
+ export default modeConfig;