@bhsd/codemirror-mediawiki 2.0.15 → 2.1.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/dist/config.d.ts +2 -66
- package/dist/main.min.js +10 -10
- package/dist/mediawiki.d.ts +1 -0
- package/mediawiki.css +0 -7
- package/mw/dist/base.js +7 -3
- package/package.json +1 -1
package/dist/mediawiki.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface MwConfig {
|
|
|
12
12
|
doubleUnderscore: [Record<string, unknown>, Record<string, unknown>];
|
|
13
13
|
variants?: string[];
|
|
14
14
|
img?: Record<string, string>;
|
|
15
|
+
nsid: Record<string, number>;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Gets a LanguageSupport instance for the MediaWiki mode.
|
package/mediawiki.css
CHANGED
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
.cm-mw-skipformatting {
|
|
39
39
|
background-color: #adf;
|
|
40
40
|
}
|
|
41
|
-
.cm-mw-indenting,
|
|
42
41
|
.cm-mw-list {
|
|
43
42
|
color: #08f;
|
|
44
43
|
font-weight: bold;
|
|
@@ -105,12 +104,6 @@
|
|
|
105
104
|
.cm-mw-extlink,
|
|
106
105
|
.cm-mw-free-extlink {
|
|
107
106
|
color: #36c;
|
|
108
|
-
}
|
|
109
|
-
.cm-mw-link-pagename:not(.cm-mw-strong),
|
|
110
|
-
.cm-mw-link-bracket,
|
|
111
|
-
.cm-mw-link-delimiter,
|
|
112
|
-
.cm-mw-extlink:not(.cm-mw-strong),
|
|
113
|
-
.cm-mw-free-extlink:not(.cm-mw-strong) {
|
|
114
107
|
font-weight: normal;
|
|
115
108
|
}
|
|
116
109
|
.cm-mw-link,
|
package/mw/dist/base.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CodeMirror6 } from 'https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki@2.0
|
|
1
|
+
import { CodeMirror6 } from 'https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki@2.1.0/dist/main.min.js';
|
|
2
2
|
(() => {
|
|
3
3
|
var _a;
|
|
4
|
-
mw.loader.load('https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki@2.0
|
|
4
|
+
mw.loader.load('https://testingcf.jsdelivr.net/npm/@bhsd/codemirror-mediawiki@2.1.0/mediawiki.min.css', 'text/css');
|
|
5
5
|
const instances = new WeakMap();
|
|
6
6
|
$.valHooks['textarea'] = {
|
|
7
7
|
get(elem) {
|
|
@@ -78,7 +78,10 @@ import { CodeMirror6 } from 'https://testingcf.jsdelivr.net/npm/@bhsd/codemirror
|
|
|
78
78
|
}
|
|
79
79
|
const isIPE = config && Object.values(config.functionSynonyms[0]).includes(true);
|
|
80
80
|
if (config && config.img && config.variants && !isIPE) {
|
|
81
|
-
return
|
|
81
|
+
return {
|
|
82
|
+
...config,
|
|
83
|
+
nsid: mw.config.get('wgNamespaceIds'),
|
|
84
|
+
};
|
|
82
85
|
}
|
|
83
86
|
const { query: { general: { variants }, magicwords, extensiontags, functionhooks, variables }, } = await new mw.Api().get({
|
|
84
87
|
meta: 'siteinfo',
|
|
@@ -126,6 +129,7 @@ import { CodeMirror6 } from 'https://testingcf.jsdelivr.net/npm/@bhsd/codemirror
|
|
|
126
129
|
}
|
|
127
130
|
config.img = getConfig(getAliases(magicwords.filter(({ name }) => name.startsWith('img_'))));
|
|
128
131
|
config.variants = variants ? variants.map(({ code }) => code) : [];
|
|
132
|
+
config.nsid = mw.config.get('wgNamespaceIds');
|
|
129
133
|
mw.config.set('extCodeMirrorConfig', config);
|
|
130
134
|
ALL_SETTINGS_CACHE[SITE_ID] = { config: config, time: Date.now() };
|
|
131
135
|
localStorage.setItem('InPageEditMwConfig', JSON.stringify(ALL_SETTINGS_CACHE));
|