@bhsd/codemirror-mediawiki 2.29.2 → 2.30.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 +0 -1
- package/dist/codemirror.js +23 -8
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/fold.d.ts +4 -2
- package/dist/fold.js +31 -14
- package/dist/indent.d.ts +2 -2
- package/dist/indent.js +3 -3
- package/dist/linter.d.ts +15 -6
- package/dist/linter.js +18 -9
- package/dist/main.min.js +20 -20
- package/dist/mw.min.js +25 -25
- package/dist/openLinks.js +19 -8
- package/dist/statusBar.js +2 -2
- package/dist/token.js +3 -3
- package/dist/wiki.min.js +24 -24
- package/i18n/en.json +3 -2
- package/i18n/zh-hans.json +3 -2
- package/i18n/zh-hant.json +3 -2
- package/mediawiki.css +1 -1
- package/package.json +6 -6
package/dist/openLinks.js
CHANGED
|
@@ -14,22 +14,33 @@ const modKey = isMac ? 'metaKey' : 'ctrlKey', key = isMac ? 'Meta' : 'Control',
|
|
|
14
14
|
'exttag-attribute-value.cm-mw-pagename',
|
|
15
15
|
'file-text.cm-mw-pagename',
|
|
16
16
|
];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (const ele of document.querySelectorAll('.cm-content')) {
|
|
17
|
+
const toggleOpenLinks = (toggle) => {
|
|
18
|
+
for (const ele of document.querySelectorAll('.cm-content')) {
|
|
19
|
+
if (toggle) {
|
|
21
20
|
ele.style.setProperty('--codemirror-cursor', 'pointer');
|
|
22
21
|
}
|
|
22
|
+
else {
|
|
23
|
+
ele.style.removeProperty('--codemirror-cursor');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
28
|
+
globalThis.document?.addEventListener('keydown', e => {
|
|
29
|
+
if (e.key === key) {
|
|
30
|
+
toggleOpenLinks(true);
|
|
23
31
|
}
|
|
24
32
|
});
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
26
33
|
globalThis.document?.addEventListener('keyup', e => {
|
|
27
34
|
if (e.key === key) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
toggleOpenLinks();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
globalThis.document?.addEventListener('visibilitychange', () => {
|
|
39
|
+
if (document.hidden) {
|
|
40
|
+
toggleOpenLinks();
|
|
31
41
|
}
|
|
32
42
|
});
|
|
43
|
+
/* eslint-enable @typescript-eslint/no-unnecessary-condition */
|
|
33
44
|
const wrapURL = (url) => url.startsWith('//') ? location.protocol + url : url;
|
|
34
45
|
export const mouseEventListener = (e, view, langConfig) => {
|
|
35
46
|
if (!e[modKey]
|
package/dist/statusBar.js
CHANGED
|
@@ -110,12 +110,12 @@ export default (fixer) => showPanel.of(view => {
|
|
|
110
110
|
dom.append(worker, message, position);
|
|
111
111
|
return {
|
|
112
112
|
dom,
|
|
113
|
-
update({ state: { selection: { main }, doc }, transactions, docChanged, selectionSet }) {
|
|
113
|
+
update({ state: { selection: { main }, doc, readOnly }, transactions, docChanged, selectionSet }) {
|
|
114
114
|
for (const tr of transactions) {
|
|
115
115
|
for (const effect of tr.effects) {
|
|
116
116
|
if (effect.is(setDiagnosticsEffect)) {
|
|
117
117
|
diagnostics = effect.value;
|
|
118
|
-
const fixable = Boolean(fixer) && diagnostics.some(hasFix), { classList } = fix.firstChild;
|
|
118
|
+
const fixable = !readOnly && Boolean(fixer) && diagnostics.some(hasFix), { classList } = fix.firstChild;
|
|
119
119
|
classList.toggle('cm-status-fix-enabled', fixable);
|
|
120
120
|
classList.toggle('cm-status-fix-disabled', !fixable);
|
|
121
121
|
worker.classList.toggle('cm-status-worker-enabled', diagnostics.length > 0);
|
package/dist/token.js
CHANGED
|
@@ -1860,7 +1860,7 @@ let MediaWiki = (() => {
|
|
|
1860
1860
|
return (stream, state) => {
|
|
1861
1861
|
if (stream.match(begin ? /^<\/nowiki>/iu : /^<nowiki>/iu)) {
|
|
1862
1862
|
state.tokenize = this.inPre(!begin);
|
|
1863
|
-
return tokens.
|
|
1863
|
+
return tokens.ignored;
|
|
1864
1864
|
}
|
|
1865
1865
|
else if (this.hasVariants && stream.match('-{')) {
|
|
1866
1866
|
chain(state, this.inConvert('', true, true, true));
|
|
@@ -1893,11 +1893,11 @@ let MediaWiki = (() => {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
const mt = stream.match(/^\{\{(?!\{(?!\{))/u);
|
|
1895
1895
|
if (mt) {
|
|
1896
|
-
return this.eatTransclusion(stream, state) ?? tokens.
|
|
1896
|
+
return this.eatTransclusion(stream, state) ?? tokens.ignored;
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
1899
|
if (stream.match(re)) {
|
|
1900
|
-
return tokens.
|
|
1900
|
+
return tokens.ignored;
|
|
1901
1901
|
}
|
|
1902
1902
|
stream.eat('<');
|
|
1903
1903
|
chain(state, this.eatTagName(tag));
|