@bhsd/codemirror-mediawiki 2.30.3 → 3.0.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 +177 -27
- package/dist/codemirror.d.ts +74 -48
- package/dist/codemirror.js +180 -229
- package/dist/color.d.ts +1 -6
- package/dist/color.js +1 -8
- package/dist/config.js +5 -6
- package/dist/escape.js +2 -2
- package/dist/fold.d.ts +53 -6
- package/dist/fold.js +140 -136
- package/dist/hover.js +1 -1
- package/dist/indent.d.ts +5 -1
- package/dist/indent.js +2 -1
- package/dist/inlay.js +1 -1
- package/dist/javascript.d.ts +1 -0
- package/dist/javascript.js +2 -4
- package/dist/keybindings.js +1 -0
- package/dist/linter.d.ts +1 -1
- package/dist/linter.js +47 -11
- package/dist/lintsource.d.ts +14 -0
- package/dist/lintsource.js +159 -0
- package/dist/lsp.d.ts +3 -0
- package/dist/lsp.js +34 -0
- package/dist/main.min.js +25 -24
- package/dist/matchBrackets.d.ts +1 -1
- package/dist/matchTag.js +2 -2
- package/dist/mediawiki.js +3 -2
- package/dist/mw.min.js +30 -29
- package/dist/mwConfig.js +2 -5
- package/dist/ref.js +1 -1
- package/dist/signature.js +1 -1
- package/dist/statusBar.d.ts +1 -1
- package/dist/token.d.ts +14 -12
- package/dist/token.js +83 -62
- package/dist/vue.d.ts +3 -0
- package/dist/vue.js +14 -0
- package/dist/wiki.min.js +29 -28
- package/i18n/en.json +2 -3
- package/i18n/zh-hans.json +2 -3
- package/i18n/zh-hant.json +2 -3
- package/package.json +21 -12
package/dist/matchBrackets.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import type { Config, MatchResult } from '@codemirror/language';
|
|
|
3
3
|
import type { SyntaxNode } from '@lezer/common';
|
|
4
4
|
export declare const findEnclosingBrackets: (node: SyntaxNode, pos: number, brackets: string) => MatchResult | undefined;
|
|
5
5
|
export declare const findEnclosingPlainBrackets: (state: EditorState, pos: number, config: Required<Config>) => MatchResult | null;
|
|
6
|
-
declare const _default: (configs
|
|
6
|
+
declare const _default: (configs?: Config) => Extension;
|
|
7
7
|
export default _default;
|
package/dist/matchTag.js
CHANGED
|
@@ -109,8 +109,8 @@ export const matchTag = (state, pos) => {
|
|
|
109
109
|
const end = searchTag(state, start);
|
|
110
110
|
return end ? { matched: true, start, end } : { matched: false, start };
|
|
111
111
|
};
|
|
112
|
-
const matchingMark = Decoration.mark({ class: 'cm-matchingTag' }), nonmatchingMark = Decoration.mark({ class: 'cm-nonmatchingTag' });
|
|
113
|
-
export default StateField.define({
|
|
112
|
+
const matchingMark = /* @__PURE__ */ Decoration.mark({ class: 'cm-matchingTag' }), nonmatchingMark = /* @__PURE__ */ Decoration.mark({ class: 'cm-nonmatchingTag' });
|
|
113
|
+
export default /* @__PURE__ */ StateField.define({
|
|
114
114
|
create() {
|
|
115
115
|
return Decoration.none;
|
|
116
116
|
},
|
package/dist/mediawiki.js
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { HighlightStyle, LanguageSupport, StreamLanguage, syntaxHighlighting, syntaxTree, } from '@codemirror/language';
|
|
7
7
|
import { insertCompletionText, pickedCompletion } from '@codemirror/autocomplete';
|
|
8
|
+
import { wmf } from '@bhsd/common';
|
|
8
9
|
import { commonHtmlAttrs, htmlAttrs, extAttrs } from 'wikiparser-node/dist/util/sharable.mjs';
|
|
9
10
|
import { MediaWiki } from './token';
|
|
10
11
|
import { htmlTags, tokens } from './config';
|
|
11
12
|
import { braceStackUpdate } from './fold';
|
|
12
|
-
const
|
|
13
|
+
const re = new RegExp(String.raw `\.(?:${wmf})\.org$`, 'u');
|
|
13
14
|
/**
|
|
14
15
|
* 检查首字母大小写并插入正确的自动填充内容
|
|
15
16
|
* @param view
|
|
@@ -162,7 +163,7 @@ export class FullMediaWiki extends MediaWiki {
|
|
|
162
163
|
const { state, pos, explicit } = context, node = syntaxTree(state).resolve(pos, -1), types = new Set(node.name.split('_')), isParserFunction = hasTag(types, 'parserFunctionName'),
|
|
163
164
|
/** 开头不包含` `,但可能包含`_` */ search = state.sliceDoc(node.from, pos).trimStart(), start = pos - search.length;
|
|
164
165
|
let { prevSibling } = node;
|
|
165
|
-
if (explicit || isParserFunction && search.includes('#') ||
|
|
166
|
+
if (explicit || isParserFunction && search.includes('#') || re.test(location.hostname)) {
|
|
166
167
|
const validFor = /^[^|{}<>[\]#]*$/u;
|
|
167
168
|
if (isParserFunction || hasTag(types, 'templateName')) {
|
|
168
169
|
const options = search.includes(':') ? [] : [...this.functionSynonyms], suggestions = await this.#linkSuggest(search, 10) ?? { offset: 0, options: [] };
|