@bhsd/codemirror-mediawiki 3.11.1 → 3.11.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/codemirror.js +2 -13
- package/dist/javascript-globals.d.ts +1 -1
- package/dist/javascript-globals.js +11 -1
- package/dist/javascript.js +17 -9
- package/dist/linter.d.ts +6 -1
- package/dist/linter.js +5 -3
- package/dist/lintsource.js +34 -8
- package/dist/main.min.js +32 -27
- package/dist/mediawiki.d.ts +8 -0
- package/dist/mediawiki.js +8 -1
- package/dist/mw.min.js +35 -30
- package/dist/openLinks.js +5 -9
- package/dist/util.d.ts +0 -8
- package/dist/util.js +0 -7
- package/dist/wiki.min.js +35 -30
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +13 -13
package/dist/mediawiki.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { MediaWiki } from './token.js';
|
|
|
9
9
|
import type { StreamParser, TagStyle } from '@codemirror/language';
|
|
10
10
|
import type { CompletionSource, Completion } from '@codemirror/autocomplete';
|
|
11
11
|
import type { MwConfig } from './token';
|
|
12
|
+
import type { TagName } from './config';
|
|
12
13
|
/**
|
|
13
14
|
* 是否是普通维基链接
|
|
14
15
|
* @param name 节点名称
|
|
@@ -23,6 +24,13 @@ export declare const isWikiLink: (name: string) => boolean;
|
|
|
23
24
|
* @test
|
|
24
25
|
*/
|
|
25
26
|
export declare const apply: (view: EditorView, completion: Completion, from: number, to: number) => void;
|
|
27
|
+
/**
|
|
28
|
+
* 判断节点是否包含指定类型
|
|
29
|
+
* @param types 节点类型
|
|
30
|
+
* @param names 指定类型
|
|
31
|
+
* @test
|
|
32
|
+
*/
|
|
33
|
+
export declare const hasTag: (types: Set<string>, names: TagName | TagName[]) => boolean;
|
|
26
34
|
/** @test */
|
|
27
35
|
export declare class FullMediaWiki extends MediaWiki {
|
|
28
36
|
#private;
|
package/dist/mediawiki.js
CHANGED
|
@@ -11,7 +11,7 @@ import { commonHtmlAttrs, htmlAttrs, extAttrs } from 'wikiparser-node/dist/util/
|
|
|
11
11
|
import { htmlTags, tokens } from './config.js';
|
|
12
12
|
import { hoverSelector, isWMF, } from './constants.js';
|
|
13
13
|
import { MediaWiki } from './token.js';
|
|
14
|
-
import {
|
|
14
|
+
import { leadingSpaces, findTemplateName } from './util.js';
|
|
15
15
|
const ranks = { Required: 1, Suggested: 2, Optional: 3, Deprecated: 4 };
|
|
16
16
|
/**
|
|
17
17
|
* 是否是普通维基链接
|
|
@@ -42,6 +42,13 @@ export const apply = (view, completion, from, to) => {
|
|
|
42
42
|
selection,
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* 判断节点是否包含指定类型
|
|
47
|
+
* @param types 节点类型
|
|
48
|
+
* @param names 指定类型
|
|
49
|
+
* @test
|
|
50
|
+
*/
|
|
51
|
+
export const hasTag = (types, names) => (Array.isArray(names) ? names : [names]).some(name => types.has(name in tokens ? tokens[name] : name));
|
|
45
52
|
/** @test */
|
|
46
53
|
export class FullMediaWiki extends MediaWiki {
|
|
47
54
|
constructor(config, templatedata = false) {
|