@bhsd/codemirror-mediawiki 3.9.1 → 3.9.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/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/fold.js +7 -1
- package/dist/hover.js +11 -2
- package/dist/main.min.js +26 -26
- package/dist/mw.min.js +27 -27
- package/dist/statusBar.js +23 -2
- package/dist/theme.js +4 -23
- package/dist/wiki.min.js +27 -27
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const base: Record<'CDN', string | undefined>, hoverSelector = ".cm-tooltip-hover-mw", diagnosticSelector = ".cm-diagnosticText-clickable", panelSelector = ".cm-panel", panelsSelector = ".cm-panels",
|
|
1
|
+
export declare const base: Record<'CDN', string | undefined>, hoverSelector = ".cm-tooltip-hover-mw", diagnosticSelector = ".cm-diagnosticText-clickable", panelSelector = ".cm-panel", panelsSelector = ".cm-panels", isolateSelector = ".cm-bidi-isolate", ltrSelector = ".cm-bidi-ltr", actionSelector = ".cm-diagnosticAction", noDetectionLangs: Set<string>, bgDark = "#4c566a", matchingCls = "cm-matchingTag", nonmatchingCls = "cm-nonmatchingTag";
|
|
2
2
|
export declare const isWMF: boolean, isMac: boolean;
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { wmf } from '@bhsd/common';
|
|
2
|
-
export const base = { CDN: undefined }, hoverSelector = '.cm-tooltip-hover-mw', diagnosticSelector = '.cm-diagnosticText-clickable', panelSelector = '.cm-panel', panelsSelector = '.cm-panels',
|
|
2
|
+
export const base = { CDN: undefined }, hoverSelector = '.cm-tooltip-hover-mw', diagnosticSelector = '.cm-diagnosticText-clickable', panelSelector = '.cm-panel', panelsSelector = '.cm-panels', isolateSelector = '.cm-bidi-isolate', ltrSelector = '.cm-bidi-ltr', actionSelector = '.cm-diagnosticAction', noDetectionLangs = new Set(['plain', 'mediawiki']), bgDark = '#4c566a', matchingCls = 'cm-matchingTag', nonmatchingCls = 'cm-nonmatchingTag';
|
|
3
3
|
export const isWMF = /* @__PURE__ */ (() => typeof location === 'object'
|
|
4
4
|
&& new RegExp(String.raw `\.(?:${wmf})\.org$`, 'u').test(location.hostname))(), isMac = /* @__PURE__ */ (() => {
|
|
5
5
|
const { vendor, userAgent, maxTouchPoints, platform } = navigator;
|
package/dist/fold.js
CHANGED
|
@@ -4,7 +4,7 @@ import { syntaxTree, ensureSyntaxTree, foldEffect, unfoldEffect, foldedRanges, u
|
|
|
4
4
|
import { getRegex } from '@bhsd/common';
|
|
5
5
|
import elt from 'crelt';
|
|
6
6
|
import { tokens } from './config.js';
|
|
7
|
-
import {
|
|
7
|
+
import { bgDark } from './constants.js';
|
|
8
8
|
import { matchTag, getTag } from './matchTag.js';
|
|
9
9
|
import { braceStackUpdate } from './util.js';
|
|
10
10
|
const getExtRegex = /* @__PURE__ */ getRegex(tag => new RegExp(`mw-tag-${tag}(?![a-z])`, 'u'));
|
|
@@ -134,6 +134,7 @@ export const foldable = (state, posOrNode, tree, refOnly = false) => {
|
|
|
134
134
|
const /** The end of the first delimiter */ from = delimiter?.to;
|
|
135
135
|
return from && from < to ? { from, to } : false;
|
|
136
136
|
};
|
|
137
|
+
const foldSelector = '.cm-tooltip-fold';
|
|
137
138
|
/**
|
|
138
139
|
* 创建折叠提示
|
|
139
140
|
* @param state
|
|
@@ -466,6 +467,11 @@ export const mediaWikiFold = /* @__PURE__ */ (() => [
|
|
|
466
467
|
opacity: 1,
|
|
467
468
|
},
|
|
468
469
|
}),
|
|
470
|
+
EditorView.baseTheme({
|
|
471
|
+
[`&dark div${foldSelector}`]: {
|
|
472
|
+
backgroundColor: bgDark,
|
|
473
|
+
},
|
|
474
|
+
}),
|
|
469
475
|
])();
|
|
470
476
|
/**
|
|
471
477
|
* 点击提示折叠模板参数
|
package/dist/hover.js
CHANGED
|
@@ -2,8 +2,9 @@ import { hoverTooltip, EditorView } from '@codemirror/view';
|
|
|
2
2
|
import { ensureSyntaxTree } from '@codemirror/language';
|
|
3
3
|
import { getLSP, loadScript, } from '@bhsd/browser';
|
|
4
4
|
import { tokens } from './config.js';
|
|
5
|
-
import { base, hoverSelector } from './constants.js';
|
|
5
|
+
import { base, hoverSelector, bgDark } from './constants.js';
|
|
6
6
|
import { indexToPos, posToIndex, createTooltipView, escHTML, } from './util.js';
|
|
7
|
+
const code = `${hoverSelector} code`;
|
|
7
8
|
export default (cm) => [
|
|
8
9
|
hoverTooltip(async (view, pos, side) => {
|
|
9
10
|
const { state } = view, { doc } = state;
|
|
@@ -59,10 +60,18 @@ export default (cm) => [
|
|
|
59
60
|
fontSize: '90%',
|
|
60
61
|
lineHeight: 1.4,
|
|
61
62
|
},
|
|
62
|
-
[
|
|
63
|
+
[code]: {
|
|
63
64
|
color: 'inherit',
|
|
64
65
|
padding: '.1em .4em',
|
|
65
66
|
borderRadius: '.4em',
|
|
66
67
|
},
|
|
67
68
|
}),
|
|
69
|
+
EditorView.baseTheme({
|
|
70
|
+
[`&light ${code}`]: {
|
|
71
|
+
backgroundColor: '#e0e6eb',
|
|
72
|
+
},
|
|
73
|
+
[`&dark ${code}`]: {
|
|
74
|
+
backgroundColor: bgDark,
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
68
77
|
];
|