@bhsd/codemirror-mediawiki 2.21.0 → 2.22.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/dist/mwConfig.mjs CHANGED
@@ -62,7 +62,9 @@ var setConfig = (config) => {
62
62
  var getMwConfig = async (modes) => {
63
63
  var _a2;
64
64
  if (mw.loader.getState("ext.CodeMirror") !== null && !VALID) {
65
- await mw.loader.using(mw.loader.getState("ext.CodeMirror.data") ? "ext.CodeMirror.data" : "ext.CodeMirror");
65
+ await mw.loader.using(
66
+ mw.loader.getState("ext.CodeMirror.data") ? "ext.CodeMirror.data" : "ext.CodeMirror"
67
+ );
66
68
  }
67
69
  let config = mw.config.get("extCodeMirrorConfig");
68
70
  if (!config && VALID) {
@@ -130,7 +132,17 @@ var getParserConfig = (minConfig, mwConfig) => {
130
132
  if (config) {
131
133
  return config;
132
134
  }
133
- const { tags, nsid, doubleUnderscore, variants, urlProtocols, redirection, functionSynonyms, img } = mwConfig, [insensitive, sensitive] = functionSynonyms;
135
+ const {
136
+ tags,
137
+ nsid,
138
+ doubleUnderscore,
139
+ variants,
140
+ urlProtocols,
141
+ redirection,
142
+ functionSynonyms,
143
+ variableIDs,
144
+ img
145
+ } = mwConfig, [insensitive, sensitive] = functionSynonyms;
134
146
  config = {
135
147
  ...minConfig,
136
148
  ext: Object.keys(tags),
@@ -141,7 +153,8 @@ var getParserConfig = (minConfig, mwConfig) => {
141
153
  ),
142
154
  variants,
143
155
  protocol: urlProtocols.replace(/\|\\?\/\\?\//u, ""),
144
- redirection: redirection != null ? redirection : minConfig.redirection
156
+ redirection: redirection != null ? redirection : minConfig.redirection,
157
+ ...variableIDs && { variable: variableIDs }
145
158
  };
146
159
  if (location.hostname.endsWith(".moegirl.org.cn")) {
147
160
  config.html[2].push("img");
@@ -154,7 +167,7 @@ var getParserConfig = (minConfig, mwConfig) => {
154
167
  }
155
168
  }
156
169
  }
157
- config.parserFunction[1] = "wikiparser" in globalThis && compareVersion(wikiparse.version, "1.15") && !Object.values(sensitive).includes(true) ? { ...sensitive, "=": "=" } : [...Object.keys(sensitive), "="];
170
+ config.parserFunction[1] = typeof wikiparse === "object" && compareVersion(wikiparse.version, "1.15") && !Object.values(sensitive).includes(true) ? { ...sensitive, "=": "=" } : [...Object.keys(sensitive), "="];
158
171
  for (const [key, val] of Object.entries(img)) {
159
172
  config.img[key] = val.slice(4);
160
173
  }
package/dist/ref.d.ts CHANGED
@@ -1,13 +1,3 @@
1
- import { EditorView } from '@codemirror/view';
2
1
  import type { Extension } from '@codemirror/state';
3
- declare type Ranges = [number, number][];
4
- /**
5
- * 异步查找注释的内容
6
- * @param view
7
- * @param target 目标名称
8
- * @param all 是否查找所有
9
- * @param group 是否group属性
10
- */
11
- export declare const findRef: (view: EditorView, target: string, all?: boolean, group?: boolean) => Promise<Ranges>;
12
2
  declare const _default: Extension;
13
3
  export default _default;