@bhsd/codemirror-mediawiki 2.29.1 → 2.30.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 +1 -2
- package/dist/codemirror.js +19 -4
- 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/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 +1529 -1432
- 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);
|