wikiplus-highlight 3.0.4 → 3.0.5

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.
Files changed (3) hide show
  1. package/README.md +0 -18
  2. package/dist/main.js +13 -14
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -7,22 +7,6 @@
7
7
 
8
8
  ## 使用方法
9
9
 
10
- ### 最新版本
11
-
12
- 在*个人 JS 页*添加以下代码:
13
-
14
- ```javascript
15
- mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@3.0.4');
16
- ```
17
-
18
-
19
-
20
- ```javascript
21
- mw.loader.load('//unpkg.com/wikiplus-highlight@3.0.4');
22
- ```
23
-
24
- ### 稳定版本
25
-
26
10
  在*个人 JS 页*添加以下代码:
27
11
 
28
12
  ```javascript
@@ -35,8 +19,6 @@ mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight');
35
19
  mw.loader.load('//unpkg.com/wikiplus-highlight');
36
20
  ```
37
21
 
38
- 由于 CDN 的缓存机制,稳定版本的更新大约会滞后一周。
39
-
40
22
  ## 更多插件
41
23
 
42
24
  使用 *[Vector](https://www.mediawiki.org/wiki/Skin:Vector)* 皮肤或 MediaWiki 1.35 及以上的 *[Minerva Neue](https://www.mediawiki.org/wiki/Skin:Minerva_Neue)* 皮肤时,在右上角的【更多】菜单将添加一个【CodeMirror插件】选项,点击后可以选择想要加载的 CodeMirror 插件。其他桌面版皮肤(包括 *[Timeless](https://www.mediawiki.org/wiki/Skin:Timeless)*、*[MonoBook](https://www.mediawiki.org/wiki/Skin:MonoBook)* 和 *[Citizen](https://www.mediawiki.org/wiki/Skin:Citizen)*)会在类似性质的菜单中插入这一选项。修改插件设置后将立刻生效。
package/dist/main.js CHANGED
@@ -8,10 +8,21 @@
8
8
  if ('wphl' in mw.libs) {
9
9
  return;
10
10
  }
11
- const version = '3.0.4';
11
+ const version = '3.0.5';
12
12
  mw.libs['wphl'] = { version }; // 开始加载
13
13
  // 路径
14
14
  const CDN = '//testingcf.jsdelivr.net', MW_CDN = 'npm/@bhsd/codemirror-mediawiki/dist/mw.min.js', REPO_CDN = 'npm/wikiplus-highlight';
15
+ const /** 加载CodeMirror 6 */ init = 'CodeMirror6' in window
16
+ ? Promise.resolve()
17
+ : new Promise(resolve => {
18
+ const script = document.createElement('script');
19
+ script.addEventListener('load', () => {
20
+ resolve();
21
+ });
22
+ script.type = 'module';
23
+ script.src = `${CDN}/${MW_CDN}`;
24
+ document.head.appendChild(script);
25
+ });
15
26
  const { wgPageName: page, wgNamespaceNumber: ns, wgPageContentModel: contentmodel, } = mw.config.get();
16
27
  const CONTENTMODELS = {
17
28
  'sanitized-css': 'css',
@@ -26,18 +37,6 @@
26
37
  };
27
38
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, @typescript-eslint/unbound-method
28
39
  const getObject = mw.storage.getObject || ((key) => JSON.parse(String(localStorage.getItem(key))));
29
- /** 根据需要加载CodeMirror6 */
30
- const init = () => 'CodeMirror6' in window
31
- ? Promise.resolve()
32
- : new Promise(resolve => {
33
- const script = document.createElement('script');
34
- script.addEventListener('load', () => {
35
- resolve();
36
- });
37
- script.type = 'module';
38
- script.src = `${CDN}/${MW_CDN}`;
39
- document.head.appendChild(script);
40
- });
41
40
  /**
42
41
  * 检查页面语言类型
43
42
  * @param value 页面内容
@@ -81,7 +80,7 @@
81
80
  * @param setting 是否是Wikiplus设置(使用json语法)
82
81
  */
83
82
  const renderEditor = async ($target, setting) => {
84
- await init();
83
+ await init;
85
84
  const cm = await CodeMirror6.fromTextArea($target[0], setting ? 'json' : await getPageMode($target.val()));
86
85
  cm.view.dom.id = 'Wikiplus-CodeMirror';
87
86
  document.querySelector('#Wikiplus-Quickedit-Jump > a').href = '#Wikiplus-CodeMirror';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiplus-highlight",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "A plugin for the MediaWiki front-end add-on \"Wikiplus\"",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -29,13 +29,13 @@
29
29
  "build": "tsc"
30
30
  },
31
31
  "devDependencies": {
32
- "@bhsd/codemirror-mediawiki": "^2.4.2",
32
+ "@bhsd/codemirror-mediawiki": "^2.6.8",
33
33
  "@stylistic/eslint-plugin": "^1.5.4",
34
34
  "@stylistic/stylelint-plugin": "^2.0.0",
35
35
  "@types/jquery": "^3.5.29",
36
36
  "@types/oojs-ui": "^0.47.6",
37
- "@typescript-eslint/eslint-plugin": "^6.19.1",
38
- "@typescript-eslint/parser": "^6.19.1",
37
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
38
+ "@typescript-eslint/parser": "^7.1.0",
39
39
  "eslint": "^8.56.0",
40
40
  "eslint-plugin-es-x": "^7.5.0",
41
41
  "eslint-plugin-eslint-comments": "^3.2.0",
@@ -43,7 +43,7 @@
43
43
  "eslint-plugin-json-es": "^1.5.7",
44
44
  "eslint-plugin-promise": "^6.1.1",
45
45
  "eslint-plugin-regexp": "^2.2.0",
46
- "eslint-plugin-unicorn": "^50.0.1",
46
+ "eslint-plugin-unicorn": "^51.0.1",
47
47
  "stylelint": "^16.1.0",
48
48
  "stylelint-config-recommended": "^14.0.0",
49
49
  "types-mediawiki": "^1.4.0",