@bhsd/codemirror-mediawiki 3.10.0 → 3.10.2
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 +78 -78
- package/dist/bidi.d.ts +5 -0
- package/dist/bidi.js +5 -0
- package/dist/codemirror.d.ts +7 -0
- package/dist/codemirror.js +10 -3
- package/dist/color.d.ts +7 -4
- package/dist/color.js +4 -0
- package/dist/css.d.ts +5 -0
- package/dist/css.js +5 -0
- package/dist/escape.d.ts +21 -1
- package/dist/escape.js +42 -24
- package/dist/fold.d.ts +55 -3
- package/dist/fold.js +54 -30
- package/dist/hover.d.ts +14 -1
- package/dist/hover.js +49 -31
- package/dist/html.js +17 -12
- package/dist/indent.d.ts +7 -0
- package/dist/indent.js +7 -1
- package/dist/inlay.js +1 -1
- package/dist/javascript.d.ts +10 -1
- package/dist/javascript.js +6 -1
- package/dist/keybindings.d.ts +1 -0
- package/dist/keybindings.js +1 -0
- package/dist/keymap.d.ts +11 -0
- package/dist/keymap.js +3 -4
- package/dist/linter.d.ts +16 -0
- package/dist/linter.js +8 -1
- package/dist/lintsource.d.ts +36 -4
- package/dist/lintsource.js +37 -4
- package/dist/lua.js +31 -20
- package/dist/main.min.js +29 -29
- package/dist/matchBrackets.d.ts +16 -0
- package/dist/matchBrackets.js +16 -0
- package/dist/matchTag.d.ts +5 -2
- package/dist/matchTag.js +7 -4
- package/dist/mediawiki.d.ts +11 -0
- package/dist/mediawiki.js +8 -4
- package/dist/mw.min.js +31 -31
- package/dist/mwConfig.js +1 -1
- package/dist/openLinks.d.ts +8 -0
- package/dist/openLinks.js +8 -0
- package/dist/ref.d.ts +15 -1
- package/dist/ref.js +81 -65
- package/dist/signature.d.ts +6 -0
- package/dist/signature.js +22 -19
- package/dist/static.d.ts +4 -0
- package/dist/static.js +4 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +3 -1
- package/dist/token.d.ts +9 -1
- package/dist/token.js +12 -6
- package/dist/util.d.ts +8 -0
- package/dist/util.js +8 -0
- package/dist/wiki.min.js +30 -30
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +22 -22
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
# @bhsd/codemirror-mediawiki
|
|
2
|
+
|
|
1
3
|
[](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki)
|
|
2
4
|
[](https://github.com/bhsd-harry/codemirror-mediawiki/actions/workflows/codeql.yml)
|
|
3
5
|
[](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki)
|
|
4
6
|
[](https://app.codacy.com/gh/bhsd-harry/codemirror-mediawiki/dashboard)
|
|
5
7
|
|
|
6
|
-
# @bhsd/codemirror-mediawiki
|
|
7
|
-
|
|
8
8
|
This repository contains a modified version of the frontend scripts and styles from [MediaWiki extension CodeMirror](https://www.mediawiki.org/wiki/Extension:CodeMirror). The goal is to support a standalone integration between [CodeMirror](https://codemimrror.net) and [Wikitext](https://www.mediawiki.org/wiki/Wikitext), without the need for a [MediaWiki environment](https://doc.wikimedia.org/mediawiki-core/master/js/).
|
|
9
9
|
|
|
10
10
|
Here is a [demo](https://bhsd-harry.github.io/codemirror-mediawiki). To experiment with the RTL (right-to-left) support, you can append `?rtl=1` to the URL.
|
|
@@ -87,7 +87,7 @@ If you are just looking for a CodeMirror 6 language mode and language support ex
|
|
|
87
87
|
|
|
88
88
|
</details>
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
## Installation
|
|
91
91
|
|
|
92
92
|
You can install the package via npm and import it as a module:
|
|
93
93
|
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
} from '@bhsd/codemirror-mediawiki';
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
## Browser Usage
|
|
113
113
|
|
|
114
114
|
<details>
|
|
115
115
|
<summary>Expand</summary>
|
|
@@ -182,9 +182,9 @@ const {
|
|
|
182
182
|
|
|
183
183
|
</details>
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
## Language modes
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
### abusefilter
|
|
188
188
|
|
|
189
189
|
*version added: 3.10.0*
|
|
190
190
|
|
|
@@ -207,7 +207,7 @@ registerAbuseFilterCore();
|
|
|
207
207
|
|
|
208
208
|
</details>
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
### css
|
|
211
211
|
|
|
212
212
|
<details>
|
|
213
213
|
<summary>Expand</summary>
|
|
@@ -235,7 +235,7 @@ registerColorPickerForCSS();
|
|
|
235
235
|
|
|
236
236
|
</details>
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
### html
|
|
239
239
|
|
|
240
240
|
<details>
|
|
241
241
|
<summary>Expand</summary>
|
|
@@ -269,7 +269,7 @@ registerColorPickerForHTML();
|
|
|
269
269
|
|
|
270
270
|
</details>
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
### javascript
|
|
273
273
|
|
|
274
274
|
<details>
|
|
275
275
|
<summary>Expand</summary>
|
|
@@ -290,7 +290,7 @@ registerJavaScriptCore();
|
|
|
290
290
|
|
|
291
291
|
</details>
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
### json
|
|
294
294
|
|
|
295
295
|
<details>
|
|
296
296
|
<summary>Expand</summary>
|
|
@@ -311,7 +311,7 @@ registerJSONCore();
|
|
|
311
311
|
|
|
312
312
|
</details>
|
|
313
313
|
|
|
314
|
-
|
|
314
|
+
### lua
|
|
315
315
|
|
|
316
316
|
<details>
|
|
317
317
|
<summary>Expand</summary>
|
|
@@ -332,7 +332,7 @@ registerLuaCore();
|
|
|
332
332
|
|
|
333
333
|
</details>
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
### mediawiki
|
|
336
336
|
|
|
337
337
|
<details>
|
|
338
338
|
<summary>Expand</summary>
|
|
@@ -385,7 +385,7 @@ registerCodeFoldingForMediaWiki();
|
|
|
385
385
|
|
|
386
386
|
</details>
|
|
387
387
|
|
|
388
|
-
|
|
388
|
+
### vue
|
|
389
389
|
|
|
390
390
|
<details>
|
|
391
391
|
<summary>Expand</summary>
|
|
@@ -417,7 +417,7 @@ registerColorPickerForVue();
|
|
|
417
417
|
|
|
418
418
|
</details>
|
|
419
419
|
|
|
420
|
-
|
|
420
|
+
### Other languages
|
|
421
421
|
|
|
422
422
|
<details>
|
|
423
423
|
<summary>Expand</summary>
|
|
@@ -440,13 +440,13 @@ registerLanguageCore('python', python);
|
|
|
440
440
|
|
|
441
441
|
</details>
|
|
442
442
|
|
|
443
|
-
|
|
443
|
+
## Themes
|
|
444
444
|
|
|
445
|
-
|
|
445
|
+
### light
|
|
446
446
|
|
|
447
447
|
This is the default theme, which is a light theme.
|
|
448
448
|
|
|
449
|
-
|
|
449
|
+
### nord
|
|
450
450
|
|
|
451
451
|
<details>
|
|
452
452
|
<summary>Expand</summary>
|
|
@@ -460,7 +460,7 @@ registerTheme('nord', nord);
|
|
|
460
460
|
|
|
461
461
|
</details>
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
### Other themes
|
|
464
464
|
|
|
465
465
|
<details>
|
|
466
466
|
<summary>Expand</summary>
|
|
@@ -475,7 +475,7 @@ registerTheme('one-dark', oneDark);
|
|
|
475
475
|
|
|
476
476
|
</details>
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
## Constructor
|
|
479
479
|
|
|
480
480
|
<details>
|
|
481
481
|
<summary>Expand</summary>
|
|
@@ -500,9 +500,9 @@ cm = new CodeMirror6(textarea, 'abusefilter', dialect);
|
|
|
500
500
|
|
|
501
501
|
</details>
|
|
502
502
|
|
|
503
|
-
|
|
503
|
+
## Accessors
|
|
504
504
|
|
|
505
|
-
|
|
505
|
+
### dialect
|
|
506
506
|
|
|
507
507
|
<details>
|
|
508
508
|
<summary>Expand</summary>
|
|
@@ -514,7 +514,7 @@ Only used for [Extension:TemplateStyles](https://www.mediawiki.org/wiki/Extensio
|
|
|
514
514
|
|
|
515
515
|
</details>
|
|
516
516
|
|
|
517
|
-
|
|
517
|
+
### lang
|
|
518
518
|
|
|
519
519
|
<details>
|
|
520
520
|
<summary>Expand</summary>
|
|
@@ -526,7 +526,7 @@ The current language mode, read-only.
|
|
|
526
526
|
|
|
527
527
|
</details>
|
|
528
528
|
|
|
529
|
-
|
|
529
|
+
### textarea
|
|
530
530
|
|
|
531
531
|
<details>
|
|
532
532
|
<summary>Expand</summary>
|
|
@@ -536,7 +536,7 @@ The textarea element replaced by CodeMirror, read-only.
|
|
|
536
536
|
|
|
537
537
|
</details>
|
|
538
538
|
|
|
539
|
-
|
|
539
|
+
### view
|
|
540
540
|
|
|
541
541
|
<details>
|
|
542
542
|
<summary>Expand</summary>
|
|
@@ -546,7 +546,7 @@ The CodeMirror EditorView instance, read-only.
|
|
|
546
546
|
|
|
547
547
|
</details>
|
|
548
548
|
|
|
549
|
-
|
|
549
|
+
### visible
|
|
550
550
|
|
|
551
551
|
<details>
|
|
552
552
|
<summary>Expand</summary>
|
|
@@ -558,9 +558,9 @@ Whether the editor is visible, read-only.
|
|
|
558
558
|
|
|
559
559
|
</details>
|
|
560
560
|
|
|
561
|
-
|
|
561
|
+
## Methods
|
|
562
562
|
|
|
563
|
-
|
|
563
|
+
### destroy
|
|
564
564
|
|
|
565
565
|
<details>
|
|
566
566
|
<summary>Expand</summary>
|
|
@@ -575,7 +575,7 @@ cm.destroy();
|
|
|
575
575
|
|
|
576
576
|
</details>
|
|
577
577
|
|
|
578
|
-
|
|
578
|
+
### extraKeys
|
|
579
579
|
|
|
580
580
|
<details>
|
|
581
581
|
<summary>Expand</summary>
|
|
@@ -593,7 +593,7 @@ cm.extraKeys([
|
|
|
593
593
|
|
|
594
594
|
</details>
|
|
595
595
|
|
|
596
|
-
|
|
596
|
+
### getLinter
|
|
597
597
|
|
|
598
598
|
<details>
|
|
599
599
|
<summary>Expand</summary>
|
|
@@ -613,7 +613,7 @@ const linterCSS = await cm.getLinter({rules}); // Stylelint configuration
|
|
|
613
613
|
|
|
614
614
|
</details>
|
|
615
615
|
|
|
616
|
-
|
|
616
|
+
### getNodeAt
|
|
617
617
|
|
|
618
618
|
<details>
|
|
619
619
|
<summary>Expand</summary>
|
|
@@ -630,7 +630,7 @@ const tree = cm.getNodeAt(0);
|
|
|
630
630
|
|
|
631
631
|
</details>
|
|
632
632
|
|
|
633
|
-
|
|
633
|
+
### hasPreference
|
|
634
634
|
|
|
635
635
|
<details>
|
|
636
636
|
<summary>Expand</summary>
|
|
@@ -647,7 +647,7 @@ const hasAutocompletion = cm.hasPreference('autocompletion');
|
|
|
647
647
|
|
|
648
648
|
</details>
|
|
649
649
|
|
|
650
|
-
|
|
650
|
+
### initialize
|
|
651
651
|
|
|
652
652
|
<details>
|
|
653
653
|
<summary>Expand</summary>
|
|
@@ -663,7 +663,7 @@ cm.initialize();
|
|
|
663
663
|
|
|
664
664
|
</details>
|
|
665
665
|
|
|
666
|
-
|
|
666
|
+
### lint
|
|
667
667
|
|
|
668
668
|
<details>
|
|
669
669
|
<summary>Expand</summary>
|
|
@@ -688,7 +688,7 @@ cm.lint(({doc}) => [
|
|
|
688
688
|
|
|
689
689
|
</details>
|
|
690
690
|
|
|
691
|
-
|
|
691
|
+
### localize
|
|
692
692
|
|
|
693
693
|
<details>
|
|
694
694
|
<summary>Expand</summary>
|
|
@@ -706,7 +706,7 @@ cm.localize({
|
|
|
706
706
|
|
|
707
707
|
</details>
|
|
708
708
|
|
|
709
|
-
|
|
709
|
+
### prefer
|
|
710
710
|
|
|
711
711
|
<details>
|
|
712
712
|
<summary>Expand</summary>
|
|
@@ -769,7 +769,7 @@ cm.prefer({
|
|
|
769
769
|
|
|
770
770
|
</details>
|
|
771
771
|
|
|
772
|
-
|
|
772
|
+
### replaceSelections
|
|
773
773
|
|
|
774
774
|
<details>
|
|
775
775
|
<summary>Expand</summary>
|
|
@@ -785,7 +785,7 @@ cm.replaceSelections(str => str.toUpperCase());
|
|
|
785
785
|
|
|
786
786
|
</details>
|
|
787
787
|
|
|
788
|
-
|
|
788
|
+
### scrollTo
|
|
789
789
|
|
|
790
790
|
<details>
|
|
791
791
|
<summary>Expand</summary>
|
|
@@ -801,7 +801,7 @@ cm.scrollTo();
|
|
|
801
801
|
|
|
802
802
|
</details>
|
|
803
803
|
|
|
804
|
-
|
|
804
|
+
### setContent
|
|
805
805
|
|
|
806
806
|
<details>
|
|
807
807
|
<summary>Expand</summary>
|
|
@@ -818,7 +818,7 @@ cm.setContent('');
|
|
|
818
818
|
|
|
819
819
|
</details>
|
|
820
820
|
|
|
821
|
-
|
|
821
|
+
### setIndent
|
|
822
822
|
|
|
823
823
|
<details>
|
|
824
824
|
<summary>Expand</summary>
|
|
@@ -835,7 +835,7 @@ cm.setIndent('\t');
|
|
|
835
835
|
|
|
836
836
|
</details>
|
|
837
837
|
|
|
838
|
-
|
|
838
|
+
### setLanguage
|
|
839
839
|
|
|
840
840
|
<details>
|
|
841
841
|
<summary>Expand</summary>
|
|
@@ -857,7 +857,7 @@ cm.setLanguage('abusefilter', dialect);
|
|
|
857
857
|
|
|
858
858
|
</details>
|
|
859
859
|
|
|
860
|
-
|
|
860
|
+
### setLineWrapping
|
|
861
861
|
|
|
862
862
|
<details>
|
|
863
863
|
<summary>Expand</summary>
|
|
@@ -874,7 +874,7 @@ cm.setLineWrapping(true);
|
|
|
874
874
|
|
|
875
875
|
</details>
|
|
876
876
|
|
|
877
|
-
|
|
877
|
+
### setTheme
|
|
878
878
|
|
|
879
879
|
<details>
|
|
880
880
|
<summary>Expand</summary>
|
|
@@ -892,7 +892,7 @@ cm.setTheme('nord');
|
|
|
892
892
|
|
|
893
893
|
</details>
|
|
894
894
|
|
|
895
|
-
|
|
895
|
+
### toggle
|
|
896
896
|
|
|
897
897
|
<details>
|
|
898
898
|
<summary>Expand</summary>
|
|
@@ -910,7 +910,7 @@ cm.toggle(false); // hide CodeMirror
|
|
|
910
910
|
|
|
911
911
|
</details>
|
|
912
912
|
|
|
913
|
-
|
|
913
|
+
### update
|
|
914
914
|
|
|
915
915
|
<details>
|
|
916
916
|
<summary>Expand</summary>
|
|
@@ -919,9 +919,9 @@ Refresh linting immediately.
|
|
|
919
919
|
|
|
920
920
|
</details>
|
|
921
921
|
|
|
922
|
-
|
|
922
|
+
## Static accessors
|
|
923
923
|
|
|
924
|
-
|
|
924
|
+
### CDN
|
|
925
925
|
|
|
926
926
|
<details>
|
|
927
927
|
<summary>Expand</summary>
|
|
@@ -937,9 +937,9 @@ CodeMirror6.CDN = 'https://cdn.jsdelivr.net';
|
|
|
937
937
|
|
|
938
938
|
</details>
|
|
939
939
|
|
|
940
|
-
|
|
940
|
+
## Static methods
|
|
941
941
|
|
|
942
|
-
|
|
942
|
+
### getMwConfig
|
|
943
943
|
|
|
944
944
|
<details>
|
|
945
945
|
<summary>Expand</summary>
|
|
@@ -956,7 +956,7 @@ const mwConfig = CodeMirror6.getMwConfig(config);
|
|
|
956
956
|
|
|
957
957
|
</details>
|
|
958
958
|
|
|
959
|
-
|
|
959
|
+
### replaceSelections (static)
|
|
960
960
|
|
|
961
961
|
<details>
|
|
962
962
|
<summary>Expand</summary>
|
|
@@ -973,9 +973,9 @@ CodeMirror6.replaceSelections(cm.view, str => str.toUpperCase());
|
|
|
973
973
|
|
|
974
974
|
</details>
|
|
975
975
|
|
|
976
|
-
|
|
976
|
+
## Extensions
|
|
977
977
|
|
|
978
|
-
|
|
978
|
+
### allowMultipleSelections
|
|
979
979
|
|
|
980
980
|
<details>
|
|
981
981
|
<summary>Expand</summary>
|
|
@@ -993,7 +993,7 @@ registerAllowMultipleSelections();
|
|
|
993
993
|
|
|
994
994
|
</details>
|
|
995
995
|
|
|
996
|
-
|
|
996
|
+
### autocompletion
|
|
997
997
|
|
|
998
998
|
<details>
|
|
999
999
|
<summary>Expand</summary>
|
|
@@ -1016,7 +1016,7 @@ registerAutocompletion();
|
|
|
1016
1016
|
|
|
1017
1017
|
</details>
|
|
1018
1018
|
|
|
1019
|
-
|
|
1019
|
+
### bidiIsolates
|
|
1020
1020
|
|
|
1021
1021
|
<details>
|
|
1022
1022
|
<summary>Expand</summary>
|
|
@@ -1034,7 +1034,7 @@ registerBidiIsolates();
|
|
|
1034
1034
|
|
|
1035
1035
|
</details>
|
|
1036
1036
|
|
|
1037
|
-
|
|
1037
|
+
### bracketMatching
|
|
1038
1038
|
|
|
1039
1039
|
<details>
|
|
1040
1040
|
<summary>Expand</summary>
|
|
@@ -1052,7 +1052,7 @@ registerBracketMatching();
|
|
|
1052
1052
|
|
|
1053
1053
|
</details>
|
|
1054
1054
|
|
|
1055
|
-
|
|
1055
|
+
### closeBrackets
|
|
1056
1056
|
|
|
1057
1057
|
<details>
|
|
1058
1058
|
<summary>Expand</summary>
|
|
@@ -1070,7 +1070,7 @@ registerCloseBrackets();
|
|
|
1070
1070
|
|
|
1071
1071
|
</details>
|
|
1072
1072
|
|
|
1073
|
-
|
|
1073
|
+
### codeFolding
|
|
1074
1074
|
|
|
1075
1075
|
<details>
|
|
1076
1076
|
<summary>Expand</summary>
|
|
@@ -1096,7 +1096,7 @@ registerCodeFolding();
|
|
|
1096
1096
|
|
|
1097
1097
|
</details>
|
|
1098
1098
|
|
|
1099
|
-
|
|
1099
|
+
### colorPicker
|
|
1100
1100
|
|
|
1101
1101
|
<details>
|
|
1102
1102
|
<summary>Expand</summary>
|
|
@@ -1114,7 +1114,7 @@ registerColorPicker();
|
|
|
1114
1114
|
|
|
1115
1115
|
</details>
|
|
1116
1116
|
|
|
1117
|
-
|
|
1117
|
+
### escape
|
|
1118
1118
|
|
|
1119
1119
|
<details>
|
|
1120
1120
|
<summary>Expand</summary>
|
|
@@ -1137,7 +1137,7 @@ registerEscape('https://www.mediawiki.org/wiki/');
|
|
|
1137
1137
|
|
|
1138
1138
|
</details>
|
|
1139
1139
|
|
|
1140
|
-
|
|
1140
|
+
### highlightActiveLine
|
|
1141
1141
|
|
|
1142
1142
|
<details>
|
|
1143
1143
|
<summary>Expand</summary>
|
|
@@ -1153,7 +1153,7 @@ registerHighlightActiveLine();
|
|
|
1153
1153
|
|
|
1154
1154
|
</details>
|
|
1155
1155
|
|
|
1156
|
-
|
|
1156
|
+
### highlightSelectionMatches
|
|
1157
1157
|
|
|
1158
1158
|
<details>
|
|
1159
1159
|
<summary>Expand</summary>
|
|
@@ -1171,7 +1171,7 @@ registerHighlightSelectionMatches();
|
|
|
1171
1171
|
|
|
1172
1172
|
</details>
|
|
1173
1173
|
|
|
1174
|
-
|
|
1174
|
+
### highlightSpecialChars
|
|
1175
1175
|
|
|
1176
1176
|
<details>
|
|
1177
1177
|
<summary>Expand</summary>
|
|
@@ -1187,7 +1187,7 @@ registerHighlightSpecialChars();
|
|
|
1187
1187
|
|
|
1188
1188
|
</details>
|
|
1189
1189
|
|
|
1190
|
-
|
|
1190
|
+
### highlightTrailingWhitespace
|
|
1191
1191
|
|
|
1192
1192
|
<details>
|
|
1193
1193
|
<summary>Expand</summary>
|
|
@@ -1205,7 +1205,7 @@ registerHighlightTrailingWhitespace();
|
|
|
1205
1205
|
|
|
1206
1206
|
</details>
|
|
1207
1207
|
|
|
1208
|
-
|
|
1208
|
+
### highlightWhitespace
|
|
1209
1209
|
|
|
1210
1210
|
<details>
|
|
1211
1211
|
<summary>Expand</summary>
|
|
@@ -1223,7 +1223,7 @@ registerHighlightWhitespace();
|
|
|
1223
1223
|
|
|
1224
1224
|
</details>
|
|
1225
1225
|
|
|
1226
|
-
|
|
1226
|
+
### hover
|
|
1227
1227
|
|
|
1228
1228
|
<details>
|
|
1229
1229
|
<summary>Expand</summary>
|
|
@@ -1242,7 +1242,7 @@ registerHover('https://www.mediawiki.org/wiki/');
|
|
|
1242
1242
|
|
|
1243
1243
|
</details>
|
|
1244
1244
|
|
|
1245
|
-
|
|
1245
|
+
### inlayHints
|
|
1246
1246
|
|
|
1247
1247
|
<details>
|
|
1248
1248
|
<summary>Expand</summary>
|
|
@@ -1261,7 +1261,7 @@ registerInlayHints('https://www.mediawiki.org/wiki/');
|
|
|
1261
1261
|
|
|
1262
1262
|
</details>
|
|
1263
1263
|
|
|
1264
|
-
|
|
1264
|
+
### openLinks
|
|
1265
1265
|
|
|
1266
1266
|
<details>
|
|
1267
1267
|
<summary>Expand</summary>
|
|
@@ -1280,7 +1280,7 @@ registerOpenLinks('https://www.mediawiki.org/wiki/');
|
|
|
1280
1280
|
|
|
1281
1281
|
</details>
|
|
1282
1282
|
|
|
1283
|
-
|
|
1283
|
+
### refHover
|
|
1284
1284
|
|
|
1285
1285
|
<details>
|
|
1286
1286
|
<summary>Expand</summary>
|
|
@@ -1299,7 +1299,7 @@ registerRefHover('https://www.mediawiki.org/wiki/');
|
|
|
1299
1299
|
|
|
1300
1300
|
</details>
|
|
1301
1301
|
|
|
1302
|
-
|
|
1302
|
+
### scrollPastEnd
|
|
1303
1303
|
|
|
1304
1304
|
<details>
|
|
1305
1305
|
<summary>Expand</summary>
|
|
@@ -1317,7 +1317,7 @@ registerScrollPastEnd();
|
|
|
1317
1317
|
|
|
1318
1318
|
</details>
|
|
1319
1319
|
|
|
1320
|
-
|
|
1320
|
+
### signatureHelp
|
|
1321
1321
|
|
|
1322
1322
|
<details>
|
|
1323
1323
|
<summary>Expand</summary>
|
|
@@ -1336,44 +1336,44 @@ registerSignatureHelp('https://www.mediawiki.org/wiki/');
|
|
|
1336
1336
|
|
|
1337
1337
|
</details>
|
|
1338
1338
|
|
|
1339
|
-
|
|
1339
|
+
## Known issues
|
|
1340
1340
|
|
|
1341
|
-
|
|
1341
|
+
### Syntax Highlighting
|
|
1342
1342
|
|
|
1343
1343
|
<details>
|
|
1344
1344
|
<summary>Expand</summary>
|
|
1345
1345
|
|
|
1346
|
-
|
|
1346
|
+
#### Extension
|
|
1347
1347
|
|
|
1348
1348
|
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)).
|
|
1349
1349
|
|
|
1350
|
-
|
|
1350
|
+
#### Transclusion
|
|
1351
1351
|
|
|
1352
1352
|
1. Non-existing parser functions starting with `#` are highlighted as parser functions ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsoid%3A%20unknown%20parser%20function%20(T314524))).
|
|
1353
1353
|
1. Wikitext in template parameter names is not highlighted ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Other%20wikitext%20in%20parameter%20names%20(T69657))).
|
|
1354
1354
|
1. Template parameter names followed by a newline are not recognized ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Templates%3A%20Handle%20comments%20in%20parameter%20names%20(T69657))).
|
|
1355
1355
|
1. Template-like syntax without a template name ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#T408631%3A%20Invalid%20templates%20inside%20template%20parameters)).
|
|
1356
1356
|
|
|
1357
|
-
|
|
1357
|
+
#### Heading
|
|
1358
1358
|
|
|
1359
1359
|
1. Comments at the SOL should not break section headings ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Section%20extraction%20prefixed%20by%20comment%20(section%201))).
|
|
1360
1360
|
|
|
1361
|
-
|
|
1361
|
+
#### Table
|
|
1362
1362
|
|
|
1363
1363
|
1. Comments at the SOL should not break table syntax ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#3c.%20Table%20cells%20without%20escapable%20prefixes%20after%20edits)).
|
|
1364
1364
|
1. `!!` in links should start a new `<th>` ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Precedence%20of%20table%20over%20links)).
|
|
1365
1365
|
|
|
1366
|
-
|
|
1366
|
+
#### External link
|
|
1367
1367
|
|
|
1368
1368
|
1. IPv6 addresses are not supported ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#IPv6%20urls%2C%20autolink%20format%20(T23261))).
|
|
1369
1369
|
1. External links inside double brackets are highlighted incorrectly ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Render%20invalid%20page%20names%20as%20plain%20text%20(T53090))).
|
|
1370
1370
|
|
|
1371
|
-
|
|
1371
|
+
#### Block element
|
|
1372
1372
|
|
|
1373
1373
|
1. Comments at the SOL break the highlighting ([Example](https://bhsd-harry.github.io/codemirror-mediawiki/tests.html#1.%20Lists%20with%20start-of-line-transparent%20tokens%20before%20bullets%3A%20Comments)).
|
|
1374
1374
|
1. False positives of preformatted text when there are categories ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Category%20%2F%20paragraph%20interactions)) or HTML tags ([Example](http://bhsd-harry.github.io/codemirror-mediawiki/tests.html#Parsing%20optional%20HTML%20elements%20(T8171))).
|
|
1375
1375
|
|
|
1376
|
-
|
|
1376
|
+
#### Language conversion
|
|
1377
1377
|
|
|
1378
1378
|
1. BCP 47 language codes are not supported in language conversion ([Example](https://bhsd-harry.github.io/wikiparser-node/tests.html#Explicit%20definition%20of%20language%20variant%20alternatives%20(BCP%2047%20codes))).
|
|
1379
1379
|
|
package/dist/bidi.d.ts
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
import { EditorView } from '@codemirror/view';
|
|
7
7
|
import type { DecorationSet } from '@codemirror/view';
|
|
8
8
|
import type { Extension } from '@codemirror/state';
|
|
9
|
+
/**
|
|
10
|
+
* 计算需要`unicode-bidi:isolate`的范围
|
|
11
|
+
* @ignore
|
|
12
|
+
* @test
|
|
13
|
+
*/
|
|
9
14
|
export declare const computeIsolates: ({ visibleRanges, state, textDirection }: EditorView) => DecorationSet;
|
|
10
15
|
declare const _default: Extension[];
|
|
11
16
|
export default _default;
|
package/dist/bidi.js
CHANGED
|
@@ -12,6 +12,11 @@ const isolateSelector = '.cm-bidi-isolate', ltrSelector = '.cm-bidi-ltr', cls =
|
|
|
12
12
|
class: `${cls} ${ltrSelector.slice(1)}`,
|
|
13
13
|
bidiIsolate: Direction.LTR,
|
|
14
14
|
}), isolate = Decoration.mark({ class: cls });
|
|
15
|
+
/**
|
|
16
|
+
* 计算需要`unicode-bidi:isolate`的范围
|
|
17
|
+
* @ignore
|
|
18
|
+
* @test
|
|
19
|
+
*/
|
|
15
20
|
export const computeIsolates = ({ visibleRanges, state, textDirection }) => {
|
|
16
21
|
const set = new RangeSetBuilder();
|
|
17
22
|
if (textDirection === Direction.RTL) {
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -33,6 +33,12 @@ export declare const menuRegistry: MenuItem[];
|
|
|
33
33
|
export declare const destroyListeners: ((view: EditorView) => void)[];
|
|
34
34
|
export declare const themes: Record<string, Extension>;
|
|
35
35
|
export declare const optionalFunctions: OptionalFunctions;
|
|
36
|
+
/**
|
|
37
|
+
* 替换选中内容
|
|
38
|
+
* @param view
|
|
39
|
+
* @param func 用于生成替换文本和光标位置的函数
|
|
40
|
+
* @test
|
|
41
|
+
*/
|
|
36
42
|
export declare const replaceSelections: (view: EditorView, func: ReplaceFunction) => void;
|
|
37
43
|
/** CodeMirror 6 editor */
|
|
38
44
|
export declare class CodeMirror6 {
|
|
@@ -151,6 +157,7 @@ export declare class CodeMirror6 {
|
|
|
151
157
|
* Replace the current selection with the result of a function
|
|
152
158
|
* @param view EditorView instance
|
|
153
159
|
* @param func function to produce the replacement text
|
|
160
|
+
* @test
|
|
154
161
|
*/
|
|
155
162
|
static replaceSelections: (view: EditorView, func: ReplaceFunction) => void;
|
|
156
163
|
/**
|
package/dist/codemirror.js
CHANGED
|
@@ -3,7 +3,7 @@ import { EditorSelection, Compartment, EditorState, SelectionRange, } from '@cod
|
|
|
3
3
|
import { syntaxHighlighting, defaultHighlightStyle, indentOnInput, indentUnit, ensureSyntaxTree, syntaxTree, } from '@codemirror/language';
|
|
4
4
|
import { defaultKeymap, historyKeymap, history, redo, indentWithTab, insertNewlineKeepIndent, deleteCharBackwardStrict, } from '@codemirror/commands';
|
|
5
5
|
import { search, searchKeymap } from '@codemirror/search';
|
|
6
|
-
import { linter, lintGutter,
|
|
6
|
+
import { linter, lintGutter, nextDiagnostic } from '@codemirror/lint';
|
|
7
7
|
import elt from 'crelt';
|
|
8
8
|
import { base, panelSelector, panelsSelector, diagnosticSelector, noDetectionLangs } from './constants.js';
|
|
9
9
|
import { light } from './theme.js';
|
|
@@ -35,6 +35,12 @@ export const optionalFunctions = {
|
|
|
35
35
|
const editExtensions = new Set(['closeBrackets', 'autocompletion', 'signatureHelp', 'escape']);
|
|
36
36
|
const linters = {};
|
|
37
37
|
const phrases = {};
|
|
38
|
+
/**
|
|
39
|
+
* 替换选中内容
|
|
40
|
+
* @param view
|
|
41
|
+
* @param func 用于生成替换文本和光标位置的函数
|
|
42
|
+
* @test
|
|
43
|
+
*/
|
|
38
44
|
export const replaceSelections = (view, func) => {
|
|
39
45
|
const { state } = view;
|
|
40
46
|
view.dispatch(state.changeByRange(range => {
|
|
@@ -301,7 +307,7 @@ export class CodeMirror6 {
|
|
|
301
307
|
return diagnostics;
|
|
302
308
|
})),
|
|
303
309
|
lintGutter(),
|
|
304
|
-
keymap.of(
|
|
310
|
+
keymap.of([{ key: 'F8', run: nextDiagnostic }]),
|
|
305
311
|
optionalFunctions.statusBar(cm, lintSources[0].fixer),
|
|
306
312
|
]
|
|
307
313
|
: [];
|
|
@@ -428,7 +434,7 @@ export class CodeMirror6 {
|
|
|
428
434
|
});
|
|
429
435
|
}
|
|
430
436
|
else if (!show && this.#visible) {
|
|
431
|
-
const { state: { selection: { main: { from, to, head } } }, hasFocus } = this.#view, {
|
|
437
|
+
const { state: { selection: { main: { from, to, head } } }, hasFocus } = this.#view, { scrollTop } = this.#view.scrollDOM;
|
|
432
438
|
this.#view.dom.style.setProperty('display', 'none', 'important');
|
|
433
439
|
this.#textarea.style.display = '';
|
|
434
440
|
this.#textarea.setSelectionRange(from, to, head === to ? 'forward' : 'backward');
|
|
@@ -517,6 +523,7 @@ export class CodeMirror6 {
|
|
|
517
523
|
* Replace the current selection with the result of a function
|
|
518
524
|
* @param view EditorView instance
|
|
519
525
|
* @param func function to produce the replacement text
|
|
526
|
+
* @test
|
|
520
527
|
*/
|
|
521
528
|
static replaceSelections = replaceSelections;
|
|
522
529
|
}
|