wikiplus-highlight 2.40.0 → 2.48.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/README.md CHANGED
@@ -11,13 +11,13 @@
11
11
  在*个人 JS 页*添加以下代码:
12
12
 
13
13
  ```javascript
14
- mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.40.0');
14
+ mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.48.2');
15
15
  ```
16
16
 
17
17
 
18
18
 
19
19
  ```javascript
20
- mw.loader.load('//unpkg.com/wikiplus-highlight@2.40.0/dist/main.min.js');
20
+ mw.loader.load('//unpkg.com/wikiplus-highlight@2.48.2/dist/main.min.js');
21
21
  ```
22
22
 
23
23
  ### 稳定版本
@@ -47,10 +47,11 @@ mw.loader.load('//unpkg.com/wikiplus-highlight/dist/main.min.js');
47
47
  - `Ctrl`/`Cmd` + `F`: 打开搜索框
48
48
  - `Ctrl`/`Cmd` + `G`: 搜索下一处
49
49
  - `Shift` + `Ctrl`/`Cmd` + `G`: 搜索上一处
50
- - `Shift` + `Ctrl` + `F` (Windows) / `Cmd` + `Alt` + `F` (Mac): 打开全文替换
51
- - `Shift` + `Ctrl` + `R` (Windows) / `Shift` + `Cmd` + `Alt` + `F` (Mac): 开始全文替换
50
+ - `Ctrl`/`Cmd` + `H`: 打开搜索框: 打开全文替换
51
+ - `Shift` + `Ctrl`/`Cmd` + `H`: 替换上一处
52
+ - `Ctrl`/`Cmd` + `Alt` + `Enter`: 开始全文替换
52
53
 
53
- 除了使用以上快捷键,也可以通过在搜索框中按下 `Enter` 键或点击搜索框右侧的 `▼` 按钮来执行搜索下一处的命令,点击 `▲` 按钮将执行搜索上一处的命令,在全文替换文本框中按下 `Enter` 键将执行全文替换命令。搜索可以使用字符串,也可以使用形如 `/re/` 或 `/re/i` 的正则表达式。正则表达式仅接受可选的 `i` 修饰符,并默认添加 `m` 修饰符,暂不接受其他修饰符。全文中匹配的字符都会添加淡粉色背景。如果没有匹配的结果,搜索框会添加粉色背景。
54
+ 除了使用以上快捷键,也可以通过在搜索框中按下 `Enter` 键或点击搜索框右侧的 `▼` 按钮来执行搜索下一处的命令,点击 `▲` 按钮将执行搜索上一处的命令;在全文替换文本框中按下 `Enter` 键将执行全文替换命令,点击全文替换右侧的 `▼` 按钮执行替换下一处的命令,点击 `▲` 按钮将执行替换上一处的命令。搜索可以使用字符串,也可以使用形如 `/re/` 或 `/re/i` 的正则表达式。正则表达式仅接受可选的 `i` 修饰符,并默认添加 `m` 修饰符,暂不接受其他修饰符。 **注意:使用先行或后行断言时可能无法逐处替换。** 使用全文中匹配的字符都会添加淡粉色背景。如果没有匹配的结果,搜索框会添加粉色背景。
54
55
 
55
56
  ### 高亮当前行
56
57
 
@@ -91,7 +92,7 @@ MediaWiki 模式下自动闭合生效的字符包括 `(`、`[`、`{` 和 `"`,
91
92
  添加以下快捷键:
92
93
 
93
94
  - `Ctrl`/`Cmd` + `/`: 将选中的文字转换为HTML实体
94
- - `Ctrl`/`Cmd` + `\`: 将选中的文字转换为URL编码
95
+ - `Ctrl`/`Cmd` + `\`: 将选中的文字解码或转换为URL编码
95
96
 
96
97
  ### 快速打开模板
97
98
 
@@ -102,7 +103,7 @@ MediaWiki 模式下自动闭合生效的字符包括 `(`、`[`、`{` 和 `"`,
102
103
  这个功能基于 [wikiparser-node](https://github.com/bhsd-harry/wikiparser-node)。开启后将在编辑框内提示可能存在的维基语法错误,同时在右侧的滚动条上也会以红黄条纹粗略地指示错误在文中出现的位置。这个插件还将添加以下快捷键:
103
104
 
104
105
  - `Ctrl`/`Cmd` + `L`: 随时开启或关闭错误提示
105
- - `Ctrl`/`Cmd` + `K`: 文本修改后立即刷新语法错误
106
+ - `Ctrl`/`Cmd` + `K`: 立即刷新语法错误
106
107
 
107
108
  ### 调整缩进
108
109
 
package/dist/main.min.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * @author 机智的小鱼君 <https://github.com/Dragon-Fish>
5
5
  * @license GPL-3.0
6
6
  */
7
- (async()=>{"use strict";if(mw.libs.wphl)return;mw.libs.wphl={};const i="2.40",w="object"==typeof mw.storage&&"function"==typeof mw.storage.getObject?mw.storage:{getObject(e){var i=localStorage.getItem(e);if(!1===i)return!1;try{return JSON.parse(i)}catch(e){return null}},setObject(e,i){try{return localStorage.setItem(e,JSON.stringify(i))}catch(e){return!1}}},r=(Object.fromEntries=Object.fromEntries||(e=>{const i={};for(var[t,o]of e)i[t]=o;return i}),(e=i)=>e.split(".").map(Number));const h=(e,...i)=>mw.msg("wphl-"+e,...i),n=(...e)=>$($.parseHTML(h(...e)));var e=(...i)=>()=>{var e=$("<p>",{html:h(...i)});return mw.notify(e,{type:"success",autoHideSeconds:"long",tag:"wikiplus-highlight"}),e},t=r().slice(0,2).join(".");const s="//fastly.jsdelivr.net",l="npm/codemirror@5.65.3",L="gh/bhsd-harry/codemirror-mediawiki@1.1.6",o="npm/wikiplus-highlight@"+t,{wgPageName:D,wgNamespaceNumber:k,wgPageContentModel:N,wgServerName:F,wgScriptPath:H,wgUserLanguage:U,skin:d}=mw["config"]["values"],u=null!==mw.loader.getState("ext.CodeMirror"),a=w.getObject("InPageEditMwConfig")||{},V=""+F+H,f=a[V]||{},b=!(f.time>Date.now()-2592e6),B={css:"css","sanitized-css":"css",javascript:"javascript",json:"javascript",wikitext:"mediawiki"},c=u?{lib:"ext.CodeMirror.lib",css:"ext.CodeMirror.lib.mode.css",javascript:"ext.CodeMirror.lib.mode.javascript",lua:l+"/mode/lua/lua.min.js",mediawiki:b?"ext.CodeMirror.data":[],htmlmixed:"ext.CodeMirror.lib.mode.htmlmixed",xml:[]}:{lib:l+"/lib/codemirror.min.js",css:l+"/mode/css/css.min.js",javascript:l+"/mode/javascript/javascript.min.js",lua:l+"/mode/lua/lua.min.js",mediawiki:[],htmlmixed:l+"/mode/htmlmixed/htmlmixed.min.js",xml:l+"/mode/xml/xml.min.js"},m={searchcursor:l+"/addon/search/searchcursor.min.js",search:o+"/search.min.js",markSelection:l+"/addon/selection/mark-selection.min.js",activeLine:l+"/addon/selection/active-line.min.js",trailingspace:l+"/addon/edit/trailingspace.min.js",matchBrackets:l+"/addon/edit/matchbrackets.min.js",closeBrackets:l+"/addon/edit/closebrackets.min.js",matchTags:o+"/matchtags.min.js",fold:o+"/fold.min.js",wikiEditor:"ext.wikiEditor",contextmenu:"mediawiki.Title",lint:l+"/addon/lint/lint.min.js",annotateScrollbar:l+"/addon/scroll/annotatescrollbar.min.js",parser:"gh/bhsd-harry/wikiparser-node@0.6.21-b/bundle/bundle.min.js",lintWikitext:o+"/lint.min.js"},x=[{option:"styleSelectedText",addon:"search",download:"markSelection",only:!0,complex:()=>!y.has("wikiEditor")},{option:"styleActiveLine",addon:"activeLine"},{option:"showTrailingSpace",addon:"trailingspace"},{option:"matchBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||{bracketRegex:/[{}[\]]/}},{option:"autoCloseBrackets",addon:"closeBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||'()[]{}""'},{option:"matchTags",addon:["matchTags","fold"],modes:new Set(["mediawiki","widget"])},{option:"fold",modes:new Set(["mediawiki","widget"])}],y=new Set(w.getObject("Wikiplus-highlight-addons")||["search"]);let v=w.getObject("Wikiplus-highlight-indent")||4;const Q={'"':"quot","'":"apos","<":"lt",">":"gt","&":"amp"," ":"nbsp"},g=i=>e=>{e.replaceSelection(e.getSelection().split("\n").map(i).join("\n"),"around")},p=g(e=>[...e].map(e=>{if(e in Q)return`&${Q[e]};`;const i=e.codePointAt();return i<256?`&#${i};`:`&#x${i.toString(16)};`}).join("")),C=({keyMap:e})=>e.default===e.pcDefault,q={"Ctrl-/":p,"Ctrl-\\":g(encodeURIComponent)},K={"Cmd-/":p,"Cmd-\\":g(encodeURIComponent)},j=(u,e)=>{if(("mediawiki"===e||"widget"===e)&&y.has("contextmenu")){const t=$(u.getWrapperElement()).addClass("CodeMirror-contextmenu"),[o]=(mw.config.get("extCodeMirrorConfig")||{functionSynonyms:[{invoke:"invoke","调用":"invoke",widget:"widget","小工具":"widget"}]})["functionSynonyms"];var i=i=>new Set(Object.keys(o).filter(e=>o[e]===i).map(e=>e.startsWith("#")?e:"#"+e));const w=i("invoke"),h=i("widget");t.contextmenu(({pageX:e,pageY:i})=>{const t=u.coordsChar({left:e,top:i}),{line:o,ch:a}=t,n=u.getTokenTypeAt(t);if(/\bmw-(?:template-name|parserfunction)\b/.test(n)){const c=u.getLineTokens(o);for(let e=c.length-1;0<e;e--){var{type:r,end:s,string:l}=c[e];c[e-1].type===r&&(c[e-1].end=s,c[e-1].string+=l,c.splice(e,1))}const m=c.findIndex(({start:e,end:i})=>e<a&&i>=a),g=c[m].string.replace(/\u200E/g,"").replace(/_/g," ").trim();if(/\bmw-template-name\b/.test(n)){const p=new mw.Title(g);return 0!==p.namespace||g.startsWith(":")?open(p.getUrl(),"_blank"):open(mw.util.getUrl("Template:"+g),"_blank"),!1}if(!(m<2)&&/\bmw-parserfunction-delimiter\b/.test(c[m-1].type)&&/\bmw-parserfunction-name\b/.test(c[m-2].type)){var d=c[m-2].string.trim().toLowerCase();if(w.has(d))open(mw.util.getUrl("Module:"+g),"_blank");else{if(!h.has(d))return;open(mw.util.getUrl("Widget:"+g,{action:"edit"}),"_blank")}return!1}}})}},S=w.getObject("Wikiplus-highlight-i18n")||{};let M;S["wphl-version"]?((e,i)=>{var[t,o]=r(e),[a,n]=r(i);return t<a||t===a&&o<n})(S["wphl-version"],i)&&(M=e("welcome-upgrade",i,0)):M=e("welcome");const W={zh:"zh-hans","zh-hans":"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hant":"zh-hant","zh-tw":"zh-hant","zh-hk":"zh-hant","zh-mo":"zh-hant",ka:"ka"}[U]||"en",J=`${s}/${o}/i18n/${W}.json`,R=S["wphl-version"]===t;e=async()=>{R&&S["wphl-lang"]===W||(Object.assign(S,await $.ajax(J,{dataType:"json",cache:!0})),w.setObject("Wikiplus-highlight-i18n",S)),mw.messages.set(S)},t=Promise.all([mw.loader.using("mediawiki.util"),e()]);const G=e=>0<e.length?mw.loader.using(e):Promise.resolve(),X=e=>0<e.length?$.ajax(s+"/"+(1<e.length?"combine/":"")+e.join(),{dataType:"script",cache:!0}):Promise.resolve(),Y=async(e,i)=>{var t=e.filter(e=>!e.includes("/")),o=e.filter(e=>e.includes("/"));return!0===i?(await G(t),X(o)):!1===i?(await X(o),G(t)):Promise.all([G(t),X(o)])};let O;const Z=(e,i=!1)=>{const t=[];for(var{option:o,addon:a=o,download:n=Array.isArray(a)?o:a,only:r}of x)r&&i||o in e.optionHandlers||!ee(a,y)||t.push(m[n]);return t},ee=(e,i)=>Array.isArray(e)?e.some(e=>i.has(e)):i.has(e),ie=e=>{let i=[];var t,o="function"==typeof window.CodeMirror,a=o?window.CodeMirror:{modes:{},prototype:{},commands:{},optionHandlers:{},helpers:{}};if(o||(i.push(c.lib),u||mw.loader.load(`${s}/${l}/lib/codemirror.min.css`,"text/css")),"mediawiki"!==(e="mediawiki"===e&&f.config&&f.config.tags.html?"html":e)&&"widget"!==e||a.modes.mediawiki||(mw.loader.load(`${s}/${L}/mediawiki.min.css`,"text/css"),i.push(L+"/mediawiki.min.js")),"widget"===e||"html"===e)for(const n of["css","javascript","mediawiki","htmlmixed","xml"])a.modes[n]||(i=i.concat(c[n]));else i=i.concat(c[e]);return a.prototype.getSearchCursor||!y.has("search")||y.has("wikiEditor")||i.push(m.searchcursor),!a.prototype.annotateScrollbar&&"mediawiki"===e&&y.has("lint")&&i.push(m.annotateScrollbar),a.commands.findForward||!y.has("search")||y.has("wikiEditor")||i.push(m.search),!window.Parser&&"mediawiki"===e&&y.has("lint")&&i.push(m.parser),!a.optionHandlers.lint&&"mediawiki"===e&&y.has("lint")&&(mw.loader.load(`${s}/${l}/addon/lint/lint.min.css`,"text/css"),i.push(m.lint)),a.helpers.lint&&a.helpers.lint.mediawiki||"mediawiki"!==e||!y.has("lint")||i.push(m.lintWikitext),y.has("wikiEditor")&&((t=mw.loader.getState("ext.wikiEditor"))?"ready"!==t&&i.push(m.wikiEditor):y.delete("wikiEditor")),"ready"!==mw.loader.getState("mediawiki.Title")&&y.has("contextmenu")&&i.push(m.contextmenu),i.push(...Z(a)),Y(i,o?void 0:u)},te=e=>{a[V]={config:e,time:Date.now()},w.setObject("InPageEditMwConfig",a)},E=e=>e.flatMap(({aliases:e,name:i})=>e.map(e=>({alias:e,name:i}))),_=e=>Object.fromEntries(e.map(({alias:e,name:i})=>[e.replace(/:$/,""),i])),oe=e=>{for(const i of["indicator","poem","ref","tabs","tab","poll"])e.tags[i]&&(e.tagModes[i]="text/mediawiki")},ae=async(e,i)=>{if("mediawiki"===e||"widget"===e){u&&b&&await i;let e=mw.config.get("extCodeMirrorConfig");if(e||b||!R||({config:e}=f,oe(e),mw.config.set("extCodeMirrorConfig",e)),e&&e.redirect&&e.img)return e;const{magicwords:a,extensiontags:n,functionhooks:r,variables:s}=(await(new mw.Api).get({meta:"siteinfo",siprop:e?"magicwords":"magicwords|extensiontags|functionhooks|variables",formatversion:2}))["query"],l=new Set(["msg","raw","msgnw","subst","safesubst"]);if(e){const[d]=e["functionSynonyms"];var t,o;if(!d.subst)for({alias:t,name:o}of E(a.filter(({name:e})=>l.has(e))))d[t.replace(/:$/,"")]=o}else{e={tagModes:{pre:"mw-tag-pre",nowiki:"mw-tag-nowiki",ref:"text/mediawiki"},tags:Object.fromEntries(n.map(e=>[e.slice(1,-1),!0])),urlProtocols:mw.config.get("wgUrlProtocols")};const c=new Set([...r,...s,...l]),m=a.filter(({name:e,aliases:i})=>i.some(e=>/^__.+__$/.test(e))||c.has(e)),g=E(m.filter(e=>e["case-sensitive"])),p=E(m.filter(e=>!e["case-sensitive"])).map(({alias:e,name:i})=>({alias:e.toLowerCase(),name:i}));e.doubleUnderscore=[_(p.filter(({alias:e})=>/^__.+__$/.test(e))),_(g.filter(({alias:e})=>/^__.+__$/.test(e)))],e.functionSynonyms=[_(p.filter(({alias:e})=>!/^__.+__|^#$/.test(e))),_(g.filter(({alias:e})=>!/^__.+__|^#$/.test(e)))]}return e.redirect=a.find(({name:e})=>"redirect"===e).aliases,e.img=_(E(a.filter(({name:e})=>e.startsWith("img_")))),oe(e),mw.config.set("extCodeMirrorConfig",e),te(e),e}},ne={getContents(){return O.getValue()},setContents(e){return O.setValue(e),this},getSelection(){return O.getSelection()},setSelection(e){return O.setSelection(O.posFromIndex(e.start),"end"in e?O.posFromIndex(e.end):void 0),O.focus(),this},replaceSelection(e){return O.replaceSelection(e),this},getCaretPosition(e){var i=O.indexFromPos(O.getCursor("from")),t=O.indexFromPos(O.getCursor("to"));return e.startAndEnd?[i,t]:i},scrollToCaretPosition(){return O.scrollIntoView(),this}},re=async(e,i)=>{const n=i?"javascript":await(async()=>{if(D.endsWith("/doc"))return"mediawiki";if(274!==k&&828!==k)return B[N];const e=274===k?"Widget":"Lua";return await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),await OO.ui.confirm(h("contentmodel"),{actions:[{label:e},{label:"Wikitext",action:"accept"}]})?"mediawiki":e.toLowerCase()})(),t=ie(n),[o]=await Promise.all([ae(n,t),t]);if(!i&&y.has("wikiEditor"))try{if("function"==typeof mw.addWikiEditor)mw.addWikiEditor(e);else{const{modules:{dialogs:{config:s}}}=$["wikiEditor"];e.wikiEditor("addModule",{...$.wikiEditor.modules.toolbar.config.getDefaultConfig(),...s.getDefaultConfig()}),s.replaceIcons(e)}}catch(e){y.delete("wikiEditor"),mw.notify("WikiEditor工具栏加载失败。",{type:"error"}),console.error(e)}"mediawiki"===n&&o.tags.html?(o.tagModes.html="htmlmixed",await ie("html")):"widget"!==n||CodeMirror.mimeModes.widget||CodeMirror.defineMIME("widget",{name:"htmlmixed",tags:{noinclude:[[null,null,"mediawiki"]]}});var a=e.height();O&&O.toTextArea();const r=i||"json"===N;if((O=CodeMirror.fromTextArea(e[0],$.extend({inputStyle:"contenteditable",lineNumbers:!/Android\b/.test(navigator.userAgent),lineWrapping:!0,mode:n,mwConfig:o,json:r},Object.fromEntries(x.map(({option:e,addon:i=e,modes:t,complex:o=e=>!t||t.has(e)})=>{var a=Array.isArray(i)?i[0]:i;return[e,y.has(a)&&o(n,r)]})),"mediawiki"===n?{extraKeys:y.has("escape")&&(C(CodeMirror)?q:K)}:{indentUnit:y.has("indentWithSpace")?v:4,indentWithTabs:!y.has("indentWithSpace")}))).setSize(null,a),O.getWrapperElement().id="Wikiplus-CodeMirror",$.fn.textSelection&&e.textSelection("register",ne),y.has("wikiEditor")){const l=e.data("wikiEditorContext"),d=CodeMirror["keyMap"],c=()=>{$.wikiEditor.modules.dialogs.api.openDialog(l,"search-and-replace")};O.addKeyMap(d.default===d.pcDefault?{"Ctrl-F":c}:{"Cmd-F":c})}if(j(O,n),$("#Wikiplus-Quickedit-Jump").children("a").attr("href","#Wikiplus-CodeMirror"),!i){const m="object"==typeof window.Wikiplus?window.Wikiplus:{getSetting(e){var i=w.getObject("Wikiplus_Settings");return i&&i[e]}},g=m.getSetting("esc_to_exit_quickedit"),p=()=>{$("#Wikiplus-Quickedit-Submit").triggerHandler("click")},u=()=>{$("#Wikiplus-Quickedit-MinorEdit").click(),$("#Wikiplus-Quickedit-Submit").triggerHandler("click")};O.addKeyMap($.extend(C(CodeMirror)?{"Ctrl-S":p,"Shift-Ctrl-S":u}:{"Cmd-S":p,"Shift-Cmd-S":u},!0===g||"true"===g?{Esc(){$("#Wikiplus-Quickedit-Back").triggerHandler("click")}}:{}))}O.refresh(),mw.hook("wiki-codemirror").fire(O)},se=document["body"],le=new MutationObserver(e=>{const i=$(e.flatMap(({addedNodes:e})=>[...e])).find("#Wikiplus-Quickedit, #Wikiplus-Setting-Input");0<i.length&&re(i,"Wikiplus-Setting-Input"===i.attr("id"))}),de=(le.observe(se,{childList:!0}),$(se).on("keydown.wphl",".ui-dialog",function(e){if("Escape"===e.key){const i=$(this).children(".ui-dialog-content").data("context");i&&i.$textarea&&"Wikiplus-Quickedit"===i.$textarea.attr("id")&&e.stopPropagation()}}),document.querySelector("#wphl-style")||mw.loader.addStyleTag("#Wikiplus-CodeMirror{border:1px solid #c8ccd1;line-height:1.3;clear:both;-moz-user-select:auto;-webkit-user-select:auto;user-select:auto}#Wikiplus-CodeMirror .CodeMirror-gutter-wrapper{-moz-user-select:none;-webkit-user-select:none;user-select:none}div.Wikiplus-InterBox{font-size:14px;z-index:100}.skin-minerva .Wikiplus-InterBox{font-size:16px}.cm-trailingspace{text-decoration:underline wavy red}div.CodeMirror span.CodeMirror-matchingbracket{box-shadow:0 0 0 2px #9aef98}div.CodeMirror span.CodeMirror-nonmatchingbracket{box-shadow:0 0 0 2px #eace64}#Wikiplus-highlight-dialog .oo-ui-messageDialog-title{margin-bottom:0.28571429em}#Wikiplus-highlight-dialog .oo-ui-flaggedElement-notice{font-weight:normal;margin:0}.CodeMirror-contextmenu .cm-mw-template-name{cursor:pointer}.skin-moeskin #ca-more-actions li>a{display:inline-block;padding:0.4rem 0.8rem;line-height:1.5}.skin-moeskin .oo-ui-windowManager-modal>.oo-ui-dialog{z-index:101}")),{get:ce=e=>e.value,set:me=(e,i)=>{e.value=i}}=(de.id="wphl-style",$.valHooks.textarea||{}),ge=e=>"Wikiplus-Quickedit"===e.id||"Wikiplus-Setting-Input"===e.id;$.valHooks.textarea={get(e){return ge(e)&&O?O.getValue():ce(e)},set(e,i){ge(e)&&O?O.setValue(i):me(e,i)}},await t;let z,I,pe,ue,we,T,he,A;const ke=(e=[...y])=>{A.toggle(e.includes("indentWithSpace"))};const fe=$(mw.util.addPortletLink({minerva:"page-actions-overflow",citizen:"p-actions",moeskin:"ca-more-actions"}[d]||"p-cactions","#",h("portlet"),"wphl-settings")).click(async e=>{if(e.preventDefault(),z)I.setValue([...y]),T.setValue(v);else{await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),z=new OO.ui.MessageDialog({id:"Wikiplus-highlight-dialog"});const t=new OO.ui.WindowManager,o=(t.$element.appendTo(se),t.addWindows([z]),I=new OO.ui.CheckboxMultiselectInputWidget({options:[...x.map(({option:e,addon:i=e})=>{const t=Array.isArray(i)?i[0]:i;return{data:t,label:n("addon-"+t.toLowerCase())}}),...["wikiEditor","escape","contextmenu","lint","indentWithSpace","otherEditors"].map(e=>({data:e,label:n("addon-"+e.toLowerCase())}))],value:[...y]}).on("change",ke))["checkboxMultiselectWidget"];pe=o.findItemFromData("search"),ue=o.findItemFromData("wikiEditor"),we=o.findItemFromData("lint"),T=new OO.ui.NumberInputWidget({min:0,value:v}),he=new OO.ui.FieldLayout(I,{label:h("addon-label"),notices:[h("addon-notice")],align:"top"}),A=new OO.ui.FieldLayout(T,{label:h("addon-indent")}),ke(),Object.assign(mw.libs.wphl,{widget:I,indentWidget:T})}var i="object"==typeof window.Wikiplus||"object"==typeof window.Pages,i=(pe.setDisabled(!i),ue.setDisabled(!i||!mw.loader.getState("ext.wikiEditor")),we.setDisabled(!i),await z.open({title:h("addon-title"),message:he.$element.add(A.$element).add($("<p>",{html:h("feedback")})),actions:[{action:"reject",label:mw.msg("ooui-dialog-message-reject")},{action:"accept",label:mw.msg("ooui-dialog-message-accept"),flags:"progressive"}],size:"en"===W||"minerva"===d?"medium":"small"}).closing);if(he.$element.detach(),A.$element.detach(),"object"==typeof i&&"accept"===i.action){i=I.getValue();y.clear();for(const a of i)y.add(a);v=Number(T.getValue()),w.setObject("Wikiplus-highlight-addons",i),w.setObject("Wikiplus-highlight-indent",v)}}),P=("minerva"===d&&fe.find(".mw-ui-icon").addClass("mw-ui-icon-minerva-settings"),"function"==typeof M&&M().find("#wphl-settings-notify").click(e=>{e.preventDefault(),$("#wphl-settings").triggerHandler("click")}),async i=>{if(y.has("otherEditors")){let e=i.getOption("mode");e="text/mediawiki"===e?"mediawiki":e;var t=Z(CodeMirror,!0),o=i.getOption("json");await Y(t);for(const{option:n,addon:r=n,modes:s,complex:l=e=>!s||s.has(e)}of x.filter(({only:e})=>!e)){var a=Array.isArray(r)?r[0]:r;void 0===i.getOption(n)&&y.has(a)&&i.setOption(n,l(e,o))}"mediawiki"===e&&y.has("escape")?i.addKeyMap(C(CodeMirror)?q:K,!0):"mediawiki"!==e&&y.has("indentWithSpace")&&(i.setOption("indentUnit",v),i.setOption("indentWithTabs",!1)),j(i,e)}});mw.hook("InPageEdit.quickEdit.codemirror").add(({cm:e})=>P(e)),mw.hook("inspector").add(e=>P(e)),mw.hook("wiki-codemirror").add(e=>{e.getTextArea&&ge(e.getTextArea())||P(e)}),mw.libs.wphl={version:i,options:x,addons:y,i18n:S,i18nLang:W,wphlStyle:de,$portlet:fe,USING_LOCAL:u,MODE_LIST:c,ADDON_LIST:m,msg:h,htmlMsg:n,escapeHTML:p,handleContextMenu:j,setI18N:e,getAddonScript:Z,updateCachedConfig:te,getMwConfig:ae,renderEditor:re,handleOtherEditors:P,isPc:C}})();
7
+ (async()=>{"use strict";if(mw.libs.wphl&&mw.libs.wphl.version)return;mw.libs.wphl=mw.libs.wphl||{};const i="2.48.2",p="object"==typeof mw.storage&&"function"==typeof mw.storage.getObject?mw.storage:{getObject(e){var i=localStorage.getItem(e);if(!1===i)return!1;try{return JSON.parse(i)}catch(e){return null}},setObject(e,i){try{return localStorage.setItem(e,JSON.stringify(i))}catch(e){return!1}}},r=(Object.fromEntries=Object.fromEntries||(e=>{const i={};for(var[t,o]of e)i[t]=o;return i}),(e=i)=>e.split(".").map(Number));const u=(e,...i)=>mw.msg("wphl-"+e,...i),n=(...e)=>$($.parseHTML(u(...e)));var e=(...i)=>()=>{var e=$("<p>",{html:u(...i)});return mw.notify(e,{type:"success",autoHideSeconds:"long",tag:"wikiplus-highlight"}),e},t=r().slice(0,2).join(".");const s="//fastly.jsdelivr.net",l="npm/codemirror@5.65.3",P="gh/bhsd-harry/codemirror-mediawiki@1.1.6",o="npm/wikiplus-highlight@"+t,{wgPageName:D,wgNamespaceNumber:w,wgPageContentModel:N,wgServerName:H,wgScriptPath:U,wgUserLanguage:F,skin:d}=mw["config"]["values"],h=null!==mw.loader.getState("ext.CodeMirror"),a=p.getObject("InPageEditMwConfig")||{},V=""+H+U,k=a[V]||{},f=!(k.time>Date.now()-2592e6),B={css:"css","sanitized-css":"css",javascript:"javascript",json:"javascript",wikitext:"mediawiki"},c=h?{lib:"ext.CodeMirror.lib",css:"ext.CodeMirror.lib.mode.css",javascript:"ext.CodeMirror.lib.mode.javascript",lua:l+"/mode/lua/lua.min.js",mediawiki:f?"ext.CodeMirror.data":[],htmlmixed:"ext.CodeMirror.lib.mode.htmlmixed",xml:[]}:{lib:l+"/lib/codemirror.min.js",css:l+"/mode/css/css.min.js",javascript:l+"/mode/javascript/javascript.min.js",lua:l+"/mode/lua/lua.min.js",mediawiki:[],htmlmixed:l+"/mode/htmlmixed/htmlmixed.min.js",xml:l+"/mode/xml/xml.min.js"},m={searchcursor:l+"/addon/search/searchcursor.min.js",search:o+"/search.min.js",markSelection:l+"/addon/selection/mark-selection.min.js",activeLine:l+"/addon/selection/active-line.min.js",trailingspace:l+"/addon/edit/trailingspace.min.js",matchBrackets:l+"/addon/edit/matchbrackets.min.js",closeBrackets:l+"/addon/edit/closebrackets.min.js",matchTags:o+"/matchtags.min.js",fold:o+"/fold.min.js",wikiEditor:"ext.wikiEditor",contextmenu:"mediawiki.Title",lint:l+"/addon/lint/lint.min.js",annotateScrollbar:l+"/addon/scroll/annotatescrollbar.min.js",parser:"gh/bhsd-harry/wikiparser-node@0.7.2-b/extensions/editor.min.js",lintWikitext:o+"/lint.min.js"},b=[{option:"styleSelectedText",addon:"search",download:"markSelection",only:!0,complex:()=>!x.has("wikiEditor")},{option:"styleActiveLine",addon:"activeLine"},{option:"showTrailingSpace",addon:"trailingspace"},{option:"matchBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||{bracketRegex:/[{}[\]]/}},{option:"autoCloseBrackets",addon:"closeBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||'()[]{}""'},{option:"matchTags",addon:["matchTags","fold"],modes:new Set(["mediawiki","widget"])},{option:"fold",modes:new Set(["mediawiki","widget"])}],x=new Set(p.getObject("Wikiplus-highlight-addons")||["search"]);let y=p.getObject("Wikiplus-highlight-indent")||4;const Q={'"':"quot","'":"apos","<":"lt",">":"gt","&":"amp"," ":"nbsp"},q=i=>e=>{e.replaceSelection(e.getSelection().split("\n").map(i).join("\n"),"around")},J=q(e=>[...e].map(e=>{if(e in Q)return`&${Q[e]};`;const i=e.codePointAt();return i<256?`&#${i};`:`&#x${i.toString(16)};`}).join("")),K=q(e=>{if(e.includes("%"))try{return decodeURIComponent(e)}catch(e){}return encodeURIComponent(e)}),v=({keyMap:e})=>e.default===e.pcDefault,R=e=>{var i=v(e)?"Ctrl":"Cmd";return{[i+"-/"]:J,[i+"-\\"]:K}},j=(u,e)=>{if(("mediawiki"===e||"widget"===e)&&x.has("contextmenu")){const t=$(u.getWrapperElement()).addClass("CodeMirror-contextmenu"),[o]=(mw.config.get("extCodeMirrorConfig")||{functionSynonyms:[{invoke:"invoke","调用":"invoke",widget:"widget","小工具":"widget"}]})["functionSynonyms"];var i=i=>new Set(Object.keys(o).filter(e=>o[e]===i).map(e=>e.startsWith("#")?e:"#"+e));const w=i("invoke"),h=i("widget");t.contextmenu(({pageX:e,pageY:i})=>{const t=u.coordsChar({left:e,top:i}),{line:o,ch:a}=t,n=u.getTokenTypeAt(t);if(/\bmw-(?:template-name|parserfunction)\b/.test(n)){const c=u.getLineTokens(o);for(let e=c.length-1;0<e;e--){var{type:r,end:s,string:l}=c[e];c[e-1].type===r&&(c[e-1].end=s,c[e-1].string+=l,c.splice(e,1))}const m=c.findIndex(({start:e,end:i})=>e<a&&i>=a),g=c[m].string.replace(/\u200E/g,"").replace(/_/g," ").trim();if(/\bmw-template-name\b/.test(n)){const p=new mw.Title(g);return 0!==p.namespace||g.startsWith(":")?open(p.getUrl(),"_blank"):open(mw.util.getUrl("Template:"+g),"_blank"),!1}if(!(m<2)&&/\bmw-parserfunction-delimiter\b/.test(c[m-1].type)&&/\bmw-parserfunction-name\b/.test(c[m-2].type)){var d=c[m-2].string.trim().toLowerCase();if(w.has(d))open(mw.util.getUrl("Module:"+g),"_blank");else{if(!h.has(d))return;open(mw.util.getUrl("Widget:"+g,{action:"edit"}),"_blank")}return!1}}})}},g=p.getObject("Wikiplus-highlight-i18n")||{};let C;g["wphl-version"]?((e,i)=>{var[t,o]=r(e),[a,n]=r(i);return t<a||t===a&&o<n})(g["wphl-version"],i)&&(C=e("welcome-upgrade",i,0)):C=e("welcome");const S={zh:"zh-hans","zh-hans":"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hant":"zh-hant","zh-tw":"zh-hant","zh-hk":"zh-hant","zh-mo":"zh-hant",ka:"ka"}[F]||"en",G=`${s}/${o}/i18n/${S}.json`,X=g["wphl-version"]===t;e=async()=>{X&&g["wphl-lang"]===S||(Object.assign(g,await $.ajax(G,{dataType:"json",cache:!0})),p.setObject("Wikiplus-highlight-i18n",g)),mw.messages.set(g)},t=Promise.all([mw.loader.using("mediawiki.util"),e()]);const M=e=>0<e.length?mw.loader.using(e):Promise.resolve(),W=e=>0<e.length?$.ajax(s+"/"+(1<e.length?"combine/":"")+e.join(),{dataType:"script",cache:!0}):Promise.resolve(),Y=async(e,i)=>{var t=e.filter(e=>!e.includes("/")),o=e.filter(e=>e.includes("/"));return!0===i?(await M(t),W(o)):!1===i?(await W(o),M(t)):Promise.all([M(t),W(o)])};let O;const Z=(e,i=!1)=>{const t=[];for(var{option:o,addon:a=o,download:n=Array.isArray(a)?o:a,only:r}of b)r&&i||o in e.optionHandlers||!ee(a,x)||t.push(m[n]);return t},ee=(e,i)=>Array.isArray(e)?e.some(e=>i.has(e)):i.has(e),ie=e=>{let i=[];var t,o="function"==typeof window.CodeMirror,a=o?window.CodeMirror:{modes:{},prototype:{},commands:{},optionHandlers:{},helpers:{}};if(o||(i.push(c.lib),h||mw.loader.load(`${s}/${l}/lib/codemirror.min.css`,"text/css")),"mediawiki"!==(e="mediawiki"===e&&k.config&&k.config.tags.html?"html":e)&&"widget"!==e||a.modes.mediawiki||(mw.loader.load(`${s}/${P}/mediawiki.min.css`,"text/css"),i.push(P+"/mediawiki.min.js")),"widget"===e||"html"===e)for(const n of["css","javascript","mediawiki","htmlmixed","xml"])a.modes[n]||(i=i.concat(c[n]));else i=i.concat(c[e]);return a.prototype.getSearchCursor||!x.has("search")||x.has("wikiEditor")||i.push(m.searchcursor),!a.prototype.annotateScrollbar&&"mediawiki"===e&&x.has("lint")&&i.push(m.annotateScrollbar),a.commands.find||!x.has("search")||x.has("wikiEditor")||i.push(m.search),!window.wikiparse&&"mediawiki"===e&&x.has("lint")&&i.push(m.parser),!a.optionHandlers.lint&&"mediawiki"===e&&x.has("lint")&&(mw.loader.load(`${s}/${l}/addon/lint/lint.min.css`,"text/css"),i.push(m.lint)),a.helpers.lint&&a.helpers.lint.mediawiki||"mediawiki"!==e||!x.has("lint")||i.push(m.lintWikitext),x.has("wikiEditor")&&((t=mw.loader.getState("ext.wikiEditor"))?"ready"!==t&&i.push(m.wikiEditor):x.delete("wikiEditor")),"ready"!==mw.loader.getState("mediawiki.Title")&&x.has("contextmenu")&&i.push(m.contextmenu),i.push(...Z(a)),Y(i,o?void 0:h)},te=e=>{a[V]={config:e,time:Date.now()},p.setObject("InPageEditMwConfig",a)},E=e=>e.flatMap(({aliases:e,name:i})=>e.map(e=>({alias:e,name:i}))),_=e=>Object.fromEntries(e.map(({alias:e,name:i})=>[e.replace(/:$/,""),i])),oe=e=>{for(const i of["indicator","poem","ref","tabs","tab","poll"])e.tags[i]&&(e.tagModes[i]="text/mediawiki")},ae=async(e,i)=>{if("mediawiki"===e||"widget"===e){h&&f&&await i;let e=mw.config.get("extCodeMirrorConfig");if(e||f||!X||({config:e}=k,oe(e),mw.config.set("extCodeMirrorConfig",e)),e&&e.redirect&&e.img)return e;const{magicwords:a,extensiontags:n,functionhooks:r,variables:s}=(await(new mw.Api).get({meta:"siteinfo",siprop:e?"magicwords":"magicwords|extensiontags|functionhooks|variables",formatversion:2}))["query"],l=new Set(["msg","raw","msgnw","subst","safesubst"]);if(e){const[d]=e["functionSynonyms"];var t,o;if(!d.subst)for({alias:t,name:o}of E(a.filter(({name:e})=>l.has(e))))d[t.replace(/:$/,"")]=o}else{e={tagModes:{pre:"mw-tag-pre",nowiki:"mw-tag-nowiki",ref:"text/mediawiki"},tags:Object.fromEntries(n.map(e=>[e.slice(1,-1),!0])),urlProtocols:mw.config.get("wgUrlProtocols")};const c=new Set([...r,...s,...l]),m=a.filter(({name:e,aliases:i})=>i.some(e=>/^__.+__$/.test(e))||c.has(e)),g=E(m.filter(e=>e["case-sensitive"])),p=E(m.filter(e=>!e["case-sensitive"])).map(({alias:e,name:i})=>({alias:e.toLowerCase(),name:i}));e.doubleUnderscore=[_(p.filter(({alias:e})=>/^__.+__$/.test(e))),_(g.filter(({alias:e})=>/^__.+__$/.test(e)))],e.functionSynonyms=[_(p.filter(({alias:e})=>!/^__.+__|^#$/.test(e))),_(g.filter(({alias:e})=>!/^__.+__|^#$/.test(e)))]}return e.redirect=a.find(({name:e})=>"redirect"===e).aliases,e.img=_(E(a.filter(({name:e})=>e.startsWith("img_")))),oe(e),mw.config.set("extCodeMirrorConfig",e),te(e),e}},ne={getContents(){return O.getValue()},setContents(e){return O.setValue(e),this},getSelection(){return O.getSelection()},setSelection(e){return O.setSelection(O.posFromIndex(e.start),"end"in e?O.posFromIndex(e.end):void 0),O.focus(),this},replaceSelection(e){return O.replaceSelection(e),this},getCaretPosition(e){var i=O.indexFromPos(O.getCursor("from")),t=O.indexFromPos(O.getCursor("to"));return e.startAndEnd?[i,t]:i},scrollToCaretPosition(){return O.scrollIntoView(),this}},re=async(e,i)=>{const n=i?"javascript":await(async()=>{if(D.endsWith("/doc"))return"mediawiki";if(274!==w&&828!==w)return B[N];const e=274===w?"Widget":"Lua";return await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),await OO.ui.confirm(u("contentmodel"),{actions:[{label:e},{label:"Wikitext",action:"accept"}]})?"mediawiki":e.toLowerCase()})(),t=ie(n),[o]=await Promise.all([ae(n,t),t]);if(!i&&x.has("wikiEditor"))try{if("function"==typeof mw.addWikiEditor)mw.addWikiEditor(e);else{const{dialogs:{config:s}}=$["wikiEditor"]["modules"];e.wikiEditor("addModule",{...$.wikiEditor.modules.toolbar.config.getDefaultConfig(),...s.getDefaultConfig()}),s.replaceIcons(e)}}catch(e){x.delete("wikiEditor"),mw.notify("WikiEditor工具栏加载失败。",{type:"error"}),console.error(e)}"mediawiki"===n&&o.tags.html?(o.tagModes.html="htmlmixed",await ie("html")):"widget"!==n||CodeMirror.mimeModes.widget||CodeMirror.defineMIME("widget",{name:"htmlmixed",tags:{noinclude:[[null,null,"mediawiki"]]}});var a=e.height();O&&O.toTextArea();const r=i||"json"===N;if((O=CodeMirror.fromTextArea(e[0],$.extend({inputStyle:"contenteditable",lineNumbers:!/Android\b/.test(navigator.userAgent),lineWrapping:!0,mode:n,mwConfig:o,json:r},Object.fromEntries(b.map(({option:e,addon:i=e,modes:t,complex:o=e=>!t||t.has(e)})=>{var a=Array.isArray(i)?i[0]:i;return[e,x.has(a)&&o(n,r)]})),"mediawiki"===n?{extraKeys:x.has("escape")&&R(CodeMirror)}:{indentUnit:x.has("indentWithSpace")?y:4,indentWithTabs:!x.has("indentWithSpace")}))).setSize(null,a),O.getWrapperElement().id="Wikiplus-CodeMirror",$.fn.textSelection&&e.textSelection("register",ne),x.has("wikiEditor")){const l=e.data("wikiEditorContext");CodeMirror.commands.find=()=>{$.wikiEditor.modules.dialogs.api.openDialog(l,"search-and-replace")}}if(j(O,n),$("#Wikiplus-Quickedit-Jump").children("a").attr("href","#Wikiplus-CodeMirror"),!i){const d="object"==typeof window.Wikiplus?window.Wikiplus:{getSetting(e){var i=p.getObject("Wikiplus_Settings");return i&&i[e]}},c=d.getSetting("esc_to_exit_quickedit"),m=()=>{$("#Wikiplus-Quickedit-Submit").triggerHandler("click")},g=()=>{$("#Wikiplus-Quickedit-MinorEdit").click(),$("#Wikiplus-Quickedit-Submit").triggerHandler("click")};a=v(CodeMirror)?"Ctrl":"Cmd";O.addKeyMap($.extend({[a+"-S"]:m,[`Shift-${a}-S`]:g},!0===c||"true"===c?{Esc(){$("#Wikiplus-Quickedit-Back").triggerHandler("click")}}:{}))}O.refresh(),mw.hook("wiki-codemirror").fire(O)},se=document["body"],le=new MutationObserver(e=>{const i=$(e.flatMap(({addedNodes:e})=>[...e])).find("#Wikiplus-Quickedit, #Wikiplus-Setting-Input");0<i.length&&re(i,"Wikiplus-Setting-Input"===i.attr("id"))}),de=(le.observe(se,{childList:!0}),$(se).on("keydown.wphl",".ui-dialog",function(e){if("Escape"===e.key){const i=$(this).children(".ui-dialog-content").data("context");i&&i.$textarea&&"Wikiplus-Quickedit"===i.$textarea.attr("id")&&e.stopPropagation()}}),document.querySelector("#wphl-style")||mw.loader.addStyleTag("#Wikiplus-CodeMirror{border:1px solid #c8ccd1;line-height:1.3;clear:both;-moz-user-select:auto;-webkit-user-select:auto;user-select:auto}#Wikiplus-CodeMirror .CodeMirror-gutter-wrapper{-moz-user-select:none;-webkit-user-select:none;user-select:none}div.Wikiplus-InterBox{font-size:14px;z-index:100}.skin-minerva .Wikiplus-InterBox{font-size:16px}.cm-trailingspace{text-decoration:underline wavy red}div.CodeMirror span.CodeMirror-matchingbracket{box-shadow:0 0 0 2px #9aef98}div.CodeMirror span.CodeMirror-nonmatchingbracket{box-shadow:0 0 0 2px #eace64}#Wikiplus-highlight-dialog .oo-ui-messageDialog-title{margin-bottom:0.28571429em}#Wikiplus-highlight-dialog .oo-ui-flaggedElement-notice{font-weight:normal;margin:0}.CodeMirror-contextmenu .cm-mw-template-name{cursor:pointer}.skin-moeskin #ca-more-actions li>a{display:inline-block;padding:0.4rem 0.8rem;line-height:1.5}.skin-moeskin .oo-ui-windowManager-modal>.oo-ui-dialog{z-index:101}")),{get:ce=e=>e.value,set:me=(e,i)=>{e.value=i}}=(de.id="wphl-style",$.valHooks.textarea||{}),ge=e=>"Wikiplus-Quickedit"===e.id||"Wikiplus-Setting-Input"===e.id;$.valHooks.textarea={get(e){return ge(e)&&O?O.getValue():ce(e)},set(e,i){ge(e)&&O?O.setValue(i):me(e,i)}},await t;let z,I,pe,ue,we,T,he,A;const ke=(e=[...x])=>{A.toggle(e.includes("indentWithSpace"))};const fe=$(mw.util.addPortletLink({minerva:"page-actions-overflow",citizen:"p-actions",moeskin:"ca-more-actions"}[d]||"p-cactions","#",u("portlet"),"wphl-settings")).click(async e=>{if(e.preventDefault(),z)I.setValue([...x]),T.setValue(y);else{await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),z=new OO.ui.MessageDialog({id:"Wikiplus-highlight-dialog"});const t=new OO.ui.WindowManager,o=(t.$element.appendTo(se),t.addWindows([z]),I=new OO.ui.CheckboxMultiselectInputWidget({options:[...b.map(({option:e,addon:i=e})=>{const t=Array.isArray(i)?i[0]:i;return{data:t,label:n("addon-"+t.toLowerCase())}}),...["wikiEditor","escape","contextmenu","lint","indentWithSpace","otherEditors"].map(e=>({data:e,label:n("addon-"+e.toLowerCase())}))],value:[...x]}).on("change",ke))["checkboxMultiselectWidget"];pe=o.findItemFromData("search"),ue=o.findItemFromData("wikiEditor"),we=o.findItemFromData("lint"),T=new OO.ui.NumberInputWidget({min:0,value:y}),he=new OO.ui.FieldLayout(I,{label:u("addon-label"),notices:[u("addon-notice")],align:"top"}),A=new OO.ui.FieldLayout(T,{label:u("addon-indent")}),ke(),Object.assign(mw.libs.wphl,{widget:I,indentWidget:T})}var i="object"==typeof window.Wikiplus||"object"==typeof window.Pages,i=(pe.setDisabled(!i),ue.setDisabled(!i||!mw.loader.getState("ext.wikiEditor")),we.setDisabled(!i),await z.open({title:u("addon-title"),message:he.$element.add(A.$element).add($("<p>",{html:u("feedback")})),actions:[{action:"reject",label:mw.msg("ooui-dialog-message-reject")},{action:"accept",label:mw.msg("ooui-dialog-message-accept"),flags:"progressive"}],size:"en"===S||"minerva"===d?"medium":"small"}).closing);if(he.$element.detach(),A.$element.detach(),"object"==typeof i&&"accept"===i.action){i=I.getValue();x.clear();for(const a of i)x.add(a);y=Number(T.getValue()),p.setObject("Wikiplus-highlight-addons",i),p.setObject("Wikiplus-highlight-indent",y)}}),L=("minerva"===d&&fe.find(".mw-ui-icon").addClass("mw-ui-icon-minerva-settings"),"function"==typeof C&&C().find("#wphl-settings-notify").click(e=>{e.preventDefault(),$("#wphl-settings").triggerHandler("click")}),async i=>{if(x.has("otherEditors")){let e=i.getOption("mode");e="text/mediawiki"===e?"mediawiki":e;var t=Z(CodeMirror,!0),o=i.getOption("json");await Y(t);for(const{option:n,addon:r=n,modes:s,complex:l=e=>!s||s.has(e)}of b.filter(({only:e})=>!e)){var a=Array.isArray(r)?r[0]:r;void 0===i.getOption(n)&&x.has(a)&&i.setOption(n,l(e,o))}"mediawiki"===e&&x.has("escape")?i.addKeyMap(R(CodeMirror),!0):"mediawiki"!==e&&x.has("indentWithSpace")&&(i.setOption("indentUnit",y),i.setOption("indentWithTabs",!1)),j(i,e)}});mw.hook("InPageEdit.quickEdit.codemirror").add(({cm:e})=>L(e)),mw.hook("inspector").add(e=>L(e)),mw.hook("wiki-codemirror").add(e=>{e.getTextArea&&ge(e.getTextArea())||L(e)}),Object.assign(mw.libs.wphl,{version:i,options:b,addons:x,i18n:g,i18nLang:S,wphlStyle:de,$portlet:fe,USING_LOCAL:h,MODE_LIST:c,ADDON_LIST:m,msg:u,htmlMsg:n,escapeHTML:J,handleContextMenu:j,setI18N:e,getAddonScript:Z,updateCachedConfig:te,getMwConfig:ae,renderEditor:re,handleOtherEditors:L,isPc:v})})();
8
8
  //# sourceMappingURL=main.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"../","sources":["main.js"],"names":["mw","libs","wphl","version","storage","getObject","key","json","localStorage","getItem","JSON","parse","e","setObject","value","setItem","stringify","getVersion","Object","fromEntries","entries","obj","str","split","map","Number","msg","args","htmlMsg","$","parseHTML","notify","$p","html","type","autoHideSeconds","tag","majorVersion","slice","join","CDN","CM_CDN","MW_CDN","REPO_CDN","wgPageName","page","wgNamespaceNumber","ns","wgPageContentModel","contentmodel","wgServerName","server","wgScriptPath","scriptPath","wgUserLanguage","userLang","skin","config","values","USING_LOCAL","loader","getState","ALL_SETTINGS_CACHE","SITE_ID","SITE_SETTINGS","EXPIRED","time","Date","now","CONTENTMODEL","css","sanitized-css","javascript","wikitext","MODE_LIST","lib","lua","mediawiki","htmlmixed","xml","ADDON_LIST","searchcursor","search","markSelection","activeLine","trailingspace","matchBrackets","closeBrackets","matchTags","fold","wikiEditor","contextmenu","lint","annotateScrollbar","parser","lintWikitext","options","option","addon","download","only","complex","addons","has","mode","bracketRegex","modes","Set","let","indent","entity","\"","'","<",">","&"," ","convert","func","doc","replaceSelection","getSelection","escapeHTML","c","code","codePointAt","toString","isPc","keyMap","default","pcDefault","extraKeysPc","Ctrl-/","Ctrl-\\","encodeURIComponent","extraKeysMac","Cmd-/","Cmd-\\","handleContextMenu","$wrapper","getWrapperElement","addClass","synonyms","get","functionSynonyms","invoke","调用","widget","小工具","getSysnonyms","keys","filter","startsWith","pageX","pageY","pos","coordsChar","left","top","line","ch","curType","getTokenTypeAt","test","tokens","getLineTokens","i","length","end","string","splice","index","findIndex","start","text","replace","trim","title","Title","namespace","open","getUrl","util","parserFunction","toLowerCase","action","i18n","welcome","a","b","a0","a1","b0","b1","cmpVersion","i18nLang","zh","zh-hans","zh-cn","zh-my","zh-sg","zh-hant","zh-tw","zh-hk","zh-mo","ka","I18N_CDN","isLatest","setI18N","async","assign","ajax","dataType","cache","messages","set","i18nPromise","Promise","all","using","getInternalScript","exts","resolve","getExternalScript","urls","getScript","local","internal","url","includes","external","cm","getAddonScript","CM","other","addonScript","Array","isArray","optionHandlers","intersect","push","arr","some","ele","initMode","scripts","state","loaded","window","CodeMirror","prototype","commands","helpers","load","tags","lang","concat","getSearchCursor","findForward","Parser","delete","undefined","updateCachedConfig","getAliases","words","flatMap","aliases","name","alias","getConfig","setPlainMode","tagModes","getMwConfig","initModePromise","redirect","img","magicwords","extensiontags","functionhooks","variables","Api","meta","siprop","formatversion","query","otherMagicwords","insensitive","subst","pre","nowiki","ref","urlProtocols","realMagicwords","allMagicwords","sensitive","word","doubleUnderscore","find","cmTextSelection","getContents","getValue","setContents","content","setValue","this","setSelection","posFromIndex","focus","getCaretPosition","caretPos","indexFromPos","getCursor","endPos","startAndEnd","scrollToCaretPosition","scrollIntoView","renderEditor","$target","setting","endsWith","pageMode","OO","ui","confirm","actions","label","getPageMode","mwConfig","addWikiEditor","modules","dialogs","toolbar","getDefaultConfig","replaceIcons","console","error","mimeModes","defineMIME","noinclude","height","toTextArea","fromTextArea","extend","inputStyle","lineNumbers","navigator","userAgent","lineWrapping","mod","mainAddon","extraKeys","indentUnit","indentWithTabs","setSize","id","fn","textSelection","context","data","callback","api","openDialog","addKeyMap","Ctrl-F","Cmd-F","children","attr","Wikiplus","getSetting","settings","escToExitQuickEdit","submit","triggerHandler","submitMinor","click","Ctrl-S","Shift-Ctrl-S","Cmd-S","Shift-Cmd-S","Esc","refresh","hook","fire","body","document","observer","MutationObserver","records","$editArea","addedNodes","wphlStyle","observe","childList","on","$textarea","stopPropagation","querySelector","addStyleTag","elem","valHooks","textarea","isWikiplus","dialog","searchWidget","wikiEditorWidget","lintWidget","indentWidget","field","indentField","toggleIndent","toggle","$portlet","addPortletLink","minerva","citizen","moeskin","preventDefault","MessageDialog","windowManager","WindowManager","checkboxMultiselectWidget","$element","appendTo","addWindows","CheckboxMultiselectInputWidget","findItemFromData","NumberInputWidget","min","FieldLayout","notices","align","wikiplusLoaded","Pages","setDisabled","message","add","flags","size","closing","detach","clear","handleOtherEditors","getOption","setOption","getTextArea"],"mappings":";;;;;;CAOA,uBAIC,GAAIA,GAAGC,KAAKC,KACX,OAEDF,GAAGC,KAAKC,KAAO,GAEf,MAAMC,EAAU,OAIVC,EAAgC,iBAAfJ,GAAGI,SAAwD,mBAAzBJ,GAAGI,QAAQC,UACjEL,GAA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AAT/B,GAAwBF,EAAOC,IAAI,qBAC7CgB,EAAIoU,UAAU,aAAc9U,GAC5BU,EAAIoU,UAAU,kBAAkB,IAEjCjT,EAAkBnB,EAAKf,MAGxBxG,GAAG6X,KAAK,mCAAmCsD,IACF,CAAA,CAAE5M,GAAIhH,KAASkU,EAAmBlU,IAE3EvH,GAAG6X,KAAK,aAAasD,IAA0C5T,GAAOkU,EAAmBlU,IACzFvH,GAAG6X,KAAK,mBAAmBsD,IAA0C5T,IAC/DA,EAAIqU,aAAgB3C,GAAW1R,EAAIqU,gBACvCH,EAAmBlU,KAIrBvH,GAAGC,KAAKC,KAAO,CACdC,QAAAA,EACA6F,QAAAA,EACAM,OAAAA,EACAoF,KAAAA,EACAS,SAAAA,EACAmM,UAAAA,GACAqB,SAAAA,GACAhW,YAAAA,EACAe,UAAAA,EACAM,WAAAA,EACAtD,IAAAA,EACAE,QAAAA,EACA8F,WAAAA,EACAgB,kBAAAA,EACAsE,QAAAA,EACAwB,eAAAA,EACA8B,mBAAAA,GACAU,YAAAA,GACA4C,aAAAA,GACA6H,mBAAAA,EACA1T,KAAAA,IAv+BF"}
1
+ {"version":3,"sourceRoot":"../","sources":["main.js"],"names":["mw","libs","wphl","version","storage","getObject","key","json","localStorage","getItem","JSON","parse","e","setObject","value","setItem","stringify","getVersion","Object","fromEntries","entries","obj","str","split","map","Number","msg","args","htmlMsg","$","parseHTML","notify","$p","html","type","autoHideSeconds","tag","majorVersion","slice","join","CDN","CM_CDN","MW_CDN","REPO_CDN","wgPageName","page","wgNamespaceNumber","ns","wgPageContentModel","contentmodel","wgServerName","server","wgScriptPath","scriptPath","wgUserLanguage","userLang","skin","config","values","USING_LOCAL","loader","getState","ALL_SETTINGS_CACHE","SITE_ID","SITE_SETTINGS","EXPIRED","time","Date","now","CONTENTMODEL","css","sanitized-css","javascript","wikitext","MODE_LIST","lib","lua","mediawiki","htmlmixed","xml","ADDON_LIST","searchcursor","search","markSelection","activeLine","trailingspace","matchBrackets","closeBrackets","matchTags","fold","wikiEditor","contextmenu","lint","annotateScrollbar","parser","lintWikitext","options","option","addon","download","only","complex","addons","has","mode","bracketRegex","modes","Set","let","indent","entity","\"","'","<",">","&"," ","convert","func","doc","replaceSelection","getSelection","escapeHTML","c","code","codePointAt","toString","escapeURI","includes","decodeURIComponent","encodeURIComponent","isPc","keyMap","default","pcDefault","extraKeys","CM","ctrl","handleContextMenu","$wrapper","getWrapperElement","addClass","synonyms","get","functionSynonyms","invoke","调用","widget","小工具","getSysnonyms","keys","filter","startsWith","pageX","pageY","pos","coordsChar","left","top","line","ch","curType","getTokenTypeAt","test","tokens","getLineTokens","i","length","end","string","splice","index","findIndex","start","text","replace","trim","title","Title","namespace","open","getUrl","util","parserFunction","toLowerCase","action","i18n","welcome","a","b","a0","a1","b0","b1","cmpVersion","i18nLang","zh","zh-hans","zh-cn","zh-my","zh-sg","zh-hant","zh-tw","zh-hk","zh-mo","ka","I18N_CDN","isLatest","setI18N","async","assign","ajax","dataType","cache","messages","set","i18nPromise","Promise","all","using","getInternalScript","exts","resolve","getExternalScript","urls","getScript","local","internal","url","external","cm","getAddonScript","other","addonScript","Array","isArray","optionHandlers","intersect","push","arr","some","ele","initMode","scripts","state","loaded","window","CodeMirror","prototype","commands","helpers","load","tags","lang","concat","getSearchCursor","find","wikiparse","delete","undefined","updateCachedConfig","getAliases","words","flatMap","aliases","name","alias","getConfig","setPlainMode","tagModes","getMwConfig","initModePromise","redirect","img","magicwords","extensiontags","functionhooks","variables","Api","meta","siprop","formatversion","query","otherMagicwords","insensitive","subst","pre","nowiki","ref","urlProtocols","realMagicwords","allMagicwords","sensitive","word","doubleUnderscore","cmTextSelection","getContents","getValue","setContents","content","setValue","this","setSelection","posFromIndex","focus","getCaretPosition","caretPos","indexFromPos","getCursor","endPos","startAndEnd","scrollToCaretPosition","scrollIntoView","renderEditor","$target","setting","endsWith","pageMode","OO","ui","confirm","actions","label","getPageMode","mwConfig","addWikiEditor","dialogs","modules","toolbar","getDefaultConfig","replaceIcons","console","error","mimeModes","defineMIME","noinclude","height","toTextArea","fromTextArea","extend","inputStyle","lineNumbers","navigator","userAgent","lineWrapping","mod","mainAddon","indentUnit","indentWithTabs","setSize","id","fn","textSelection","context","data","api","openDialog","children","attr","Wikiplus","getSetting","settings","escToExitQuickEdit","submit","triggerHandler","submitMinor","click","addKeyMap","Esc","refresh","hook","fire","body","document","observer","MutationObserver","records","$editArea","addedNodes","wphlStyle","observe","childList","on","$textarea","stopPropagation","querySelector","addStyleTag","elem","valHooks","textarea","isWikiplus","dialog","searchWidget","wikiEditorWidget","lintWidget","indentWidget","field","indentField","toggleIndent","toggle","$portlet","addPortletLink","minerva","citizen","moeskin","preventDefault","MessageDialog","windowManager","WindowManager","checkboxMultiselectWidget","$element","appendTo","addWindows","CheckboxMultiselectInputWidget","findItemFromData","NumberInputWidget","min","FieldLayout","notices","align","wikiplusLoaded","Pages","setDisabled","message","add","flags","size","closing","detach","clear","handleOtherEditors","getOption","setOption","getTextArea"],"mappings":";;;;;;CAOA,uBAIC,GAAIA,GAAGC,KAAKC,MAAQF,GAAGC,KAAKC,KAAKC,QAChC,OAEDH,GAAGC,KAAKC,KAAOF,GAAGC,KAAKC,MAAQ,GAE/B,MAAMC,EAAU,SAIVC,EAAgC,iBAAfJ,GAAGI,SAAwD,mBAAzBJ,GAAGI,QAAQC,UACjEL,GAAGI,QACH,CAEDC,UAAUC,GACT,IAAMC,EAAOC,aAAaC,QAAQH,GAClC,IAAa,IAATC,EACH,OAAO,EAER,IACC,OAAOG,KAAKC,MAAMJ,GACjB,MAAOK,GACR,OAAO,OAITC,UAAUP,EAAKQ,GACd,IACC,OAAON,aAAaO,QAAQT,EAAKI,KAAKM,UAAUF,IAC/C,MAAOF,GACR,OAAO,KAiBLK,GAZNC,OAAOC,YAAcD,OAAOC,cAAgBC,IAC3C,MAAuCC,EAAM,GAC7C,IAAK,GAAM,CAACf,EAAKQ,KAAUM,EAC1BC,EAAIf,GAAOQ,EAEZ,OAAOO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,GAAGC,KAAKC,KAAM,CAC3BC,QAAAA,EACA6F,QAAAA,EACAM,OAAAA,EACAoF,KAAAA,EACAS,SAAAA,EACAwL,UAAAA,GACAqB,SAAAA,GACArV,YAAAA,EACAe,UAAAA,EACAM,WAAAA,EACAtD,IAAAA,EACAE,QAAAA,EACA8F,WAAAA,EACAgB,kBAAAA,EACAsE,QAAAA,EACAuB,eAAAA,EACA6B,mBAAAA,GACAU,YAAAA,GACA2C,aAAAA,GACAqH,mBAAAA,EACA3S,KAAAA,KA9+BF"}
package/i18n/en.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.40",
2
+ "wphl-version": "2.48.2",
3
3
  "wphl-lang": "en",
4
4
  "wphl-addon-search": "<span title=\"Search with a string or a regular expression\">Search</span>",
5
5
  "wphl-addon-activeline": "Show the active line",
@@ -9,7 +9,7 @@
9
9
  "wphl-addon-matchtags": "Highlight matching/nonmatching tags",
10
10
  "wphl-addon-fold": "Fold template arguments and tags' innerHTML",
11
11
  "wphl-addon-wikieditor": "Add WikiEditor toolbar",
12
- "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML encoding\nCtrl/Cmd + \\ : URL encoding\">Keyboard shortcuts for HTML/URL encoding</span>",
12
+ "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML encoding\nCtrl/Cmd + \\ : URL decoding or encoding\">Keyboard shortcuts for HTML/URL encoding</span>",
13
13
  "wphl-addon-contextmenu": "Open the template or module page when right clicking",
14
14
  "wphl-addon-indentwithspace": "Indent JavaScript/CSS/Lua codes with spaces instead of tabs",
15
15
  "wphl-addon-indent": "Indent",
package/i18n/ka.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.40",
2
+ "wphl-version": "2.48.2",
3
3
  "wphl-lang": "ka",
4
4
  "wphl-addon-search": "<span title=\"ძებნა ნიშნების მწკრივით ან რეგულარული გაფართოებით\">ძებნა</span>",
5
5
  "wphl-addon-activeline": "აქტიური ხაზის მონიშვნა",
@@ -14,10 +14,14 @@
14
14
  "wphl-addon-indentwithspace": "JavaScript/CSS/Lua-ის კოდებში ტაბულაციის ნაცვლად შორისებით შეწევა",
15
15
  "wphl-addon-indent": "შეწევა",
16
16
  "wphl-addon-othereditors": "არჩეული დანამატების გამოყენება სხვა მომხმარებლებისთვისაც",
17
+ "wphl-addon-lint": "Wikitext linter (Switch on/off by <code>Ctrl/Cmd + L</code>)",
17
18
  "wphl-addon-label": "აირჩიეთ ის დანამატები, რომელთა გამოყენებაც გსურთ",
18
19
  "wphl-addon-notice": "ცვლილებები აისახება Wikiplus-ის ახალი დიალოგის გახსნისას.",
19
20
  "wphl-addon-title": "Wikiplus-ის განათების დანამატები",
20
21
  "wphl-search-placeholder": "ძებნა ნიშნების მწკრივის ან რეგულარული გაფართოების ნიმუშის გამოყენებით",
22
+ "wphl-replace-placeholder": "string used in replaceAll",
23
+ "wphl-search-replace": "replaceAll",
24
+ "wphl-replace-count": "The pattern occurs $1 time(s). Do you want to replace them all?",
21
25
  "wphl-unfold": "აქ დააწკაპუნეთ, რათა $1 გაიშალოს",
22
26
  "wphl-fold": "აქ დააწკაპუნეთ, რათა $1 შეიკეცოს",
23
27
  "wphl-fold-template": "თარგის არგუმენტები",
package/i18n/zh-hans.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.40",
2
+ "wphl-version": "2.48.2",
3
3
  "wphl-lang": "zh-hans",
4
4
  "wphl-addon-search": "<span title=\"搜索字符串或正则表达式\">搜索</span>",
5
5
  "wphl-addon-activeline": "高亮显示光标所在行",
@@ -9,7 +9,7 @@
9
9
  "wphl-addon-matchtags": "高亮显示匹配和未匹配的标签",
10
10
  "wphl-addon-fold": "折叠模板参数和标签内部文本",
11
11
  "wphl-addon-wikieditor": "添加WikiEditor工具条",
12
- "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML编码\nCtrl/Cmd + \\ : URL编码\">添加HTML和URL编码快捷键</span>",
12
+ "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML编码\nCtrl/Cmd + \\ : URL解码或编码\">添加HTML和URL编码快捷键</span>",
13
13
  "wphl-addon-contextmenu": "右键点击可打开模板或模块页面",
14
14
  "wphl-addon-indentwithspace": "代码缩进使用空格而非Tab",
15
15
  "wphl-addon-indent": "缩进",
package/i18n/zh-hant.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.40",
2
+ "wphl-version": "2.48.2",
3
3
  "wphl-lang": "zh-hant",
4
4
  "wphl-addon-search": "<span title=\"搜尋字串或正規表示式\">搜尋</span>",
5
5
  "wphl-addon-activeline": "突出顯示游標所在行",
@@ -9,7 +9,7 @@
9
9
  "wphl-addon-matchtags": "突出顯示匹配和未匹配的標籤",
10
10
  "wphl-addon-fold": "摺疊模板參數和標籤內部文字",
11
11
  "wphl-addon-wikieditor": "添加WikiEditor工具條",
12
- "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML編碼\nCtrl/Cmd + \\ : URL編碼\">添加HTML和URL編碼快速鍵</span>",
12
+ "wphl-addon-escape": "<span title=\"Ctrl/Cmd + / : HTML編碼\nCtrl/Cmd + \\ : URL解碼或編碼\">添加HTML和URL編碼快速鍵</span>",
13
13
  "wphl-addon-contextmenu": "右鍵點擊可打開模板或模組頁面",
14
14
  "wphl-addon-indentwithspace": "代碼縮排使用空格而非Tab",
15
15
  "wphl-addon-indent": "縮排",
@@ -19,6 +19,9 @@
19
19
  "wphl-addon-notice": "更改將於打開新的Wikiplus編輯區時生效。",
20
20
  "wphl-addon-title": "Wikiplus突顯外掛程式",
21
21
  "wphl-search-placeholder": "使用字串或正規表示式搜尋",
22
+ "wphl-replace-placeholder": "用於全文替換的字符串",
23
+ "wphl-search-replace": "全文替換",
24
+ "wphl-replace-count": "全文共有 $1 處待替換,確認替換嗎?",
22
25
  "wphl-unfold": "點擊以展開$1",
23
26
  "wphl-fold": "點擊以摺疊$1",
24
27
  "wphl-fold-template": "模板參數",
package/lint.js CHANGED
@@ -4,20 +4,20 @@
4
4
  */
5
5
 
6
6
  (() => {
7
- /* global Parser */
7
+ /* global wikiparse */
8
8
  'use strict';
9
9
 
10
10
  const include = mw.config.get('wgNamespaceNumber') === 10 && !mw.config.get('wgPageName').endsWith('/doc'),
11
- lintOptions = {delay: 5000, selfContain: true},
12
11
  {cmpPos, Pos} = CodeMirror;
13
12
 
14
13
  /**
15
14
  * annotationSource
16
15
  * @param {string} str wikitext
17
- * @returns {CodeMirror.LintAnnotation}
16
+ * @param {CodeMirror.Editor} cm
17
+ * @returns {Promise<CodeMirror.LintAnnotation>}
18
18
  */
19
- const annotate = str => {
20
- const errors = Parser.parse(str, include).lint();
19
+ const annotate = async (str, _, cm) => {
20
+ const errors = await cm.Linter.queue(str);
21
21
  return errors.map(error => {
22
22
  const {startLine, startCol, endLine, endCol, message, severity} = error,
23
23
  lineErrors = errors.filter(({startLine: line}) => line === startLine);
@@ -31,7 +31,7 @@
31
31
  };
32
32
 
33
33
  mw.loader.addStyleTag(
34
- '.CodeMirror-line .CodeMirror-lint-mark-warning{background:#ffbf00;color:#fff}'
34
+ '.CodeMirror-line .CodeMirror-lint-mark-warning{background:#ffbf00;color:#fff;caret-color:#000}'
35
35
  + '.CodeMirror-line .CodeMirror-lint-mark-error{background:#d33;color:#fff}'
36
36
  + '.CodeMirror-lint-scroll-warn{'
37
37
  + 'background:#fc3;border-top:1px solid #fc3;border-bottom:1px solid #fc3;box-sizing:border-box'
@@ -41,7 +41,7 @@
41
41
  + '}'
42
42
  + '#wphl-lint-panel{background:#f7f7f7;border:1px solid #c8ccd1}'
43
43
  + '.wphl-lint-subpanel{margin-left:1ch;cursor:pointer}'
44
- + '.wphl-lint-count{display:inline-block;width:5ch;padding:1px 0 1px 1ch;vertical-align:text-bottom}',
44
+ + '.wphl-lint-count{display:inline-block;width:5ch;padding:1px 0 1px 1ch}',
45
45
  );
46
46
  CodeMirror.registerHelper('lint', 'mediawiki', annotate);
47
47
 
@@ -49,13 +49,13 @@
49
49
  * start linting
50
50
  * @param {CodeMirror.Editor} cm
51
51
  */
52
- const lint = cm => {
52
+ const lint = async cm => {
53
53
  const mode = cm.getOption('mode');
54
54
  if (mode !== 'mediawiki' && mode !== 'text/mediawiki') {
55
55
  return;
56
- } else if (!Parser.config) {
56
+ } else if (!wikiparse.config) {
57
57
  const {config: {values: {wgFormattedNamespaces, wgNamespaceIds}}} = mw,
58
- {minConfig: {parserFunction: [withPound,, ...modifiers]}} = Parser,
58
+ {parserFunction: [withPound,, ...modifiers]} = await wikiparse.getConfig(),
59
59
  valuesWithPound = new Set(Object.values(withPound)),
60
60
  {tags, functionSynonyms: [insensitive, sensitive], doubleUnderscore, img} = cm.getOption('mwConfig');
61
61
  for (const [k, v] of Object.entries(insensitive)) {
@@ -64,7 +64,7 @@
64
64
  insensitive[`#${k}`] = v;
65
65
  }
66
66
  }
67
- Parser.config = {
67
+ wikiparse.config = {
68
68
  ext: Object.keys(tags),
69
69
  namespaces: wgFormattedNamespaces,
70
70
  nsid: wgNamespaceIds,
@@ -76,7 +76,9 @@
76
76
  doubleUnderscore: doubleUnderscore.map(Object.keys),
77
77
  img: Object.fromEntries(Object.entries(img).map(([k, v]) => [k, v.slice(4)])),
78
78
  };
79
+ wikiparse.setConfig(wikiparse.config);
79
80
  }
81
+ cm.Linter = new wikiparse.Linter(include);
80
82
  cm.setOption('scrollButtonHeight', 0);
81
83
  let /** @type {CodeMirror.LintAnnotation[]} */ errors, /** @type {CodeMirror.LintAnnotation[]} */ warnings;
82
84
  const /** @type {Map<CodeMirror.LintAnnotation[], number>} */ positionMap = new Map();
@@ -88,7 +90,8 @@
88
90
  const nextMark = annotations => {
89
91
  const {length} = annotations;
90
92
  if (length > 0) {
91
- const iNext = annotations.findIndex(({from}) => cmpPos(from, cm.getCursor()) >= 0),
93
+ const cursor = cm.getCursor(),
94
+ iNext = Math.max(0, annotations.findIndex(({from}) => cmpPos(from, cursor) >= 0)),
92
95
  offset = positionMap.get(annotations) || 0;
93
96
  cm.scrollIntoView(annotations[(iNext + offset) % length].from);
94
97
  positionMap.set(annotations, offset + 1);
@@ -110,7 +113,8 @@
110
113
  }).click(() => {
111
114
  nextMark(warnings);
112
115
  }),
113
- $panelElement = $('<div>', {id: 'wphl-lint-panel', html: [$panelError, $panelWarn]});
116
+ $panelElement = $('<div>', {id: 'wphl-lint-panel', html: [$panelError, $panelWarn]}),
117
+ $lineDiv = $(cm.display.lineDiv);
114
118
 
115
119
  /**
116
120
  * update linting
@@ -127,36 +131,40 @@
127
131
  performLint = () => {
128
132
  cm.performLint();
129
133
  },
134
+ onInput = () => {
135
+ clearTimeout(cm.state.lint.timeout);
136
+ },
130
137
  switchOption = () => {
131
138
  if (cm.state.lint) {
132
139
  cm.setOption('lint', false);
140
+ $lineDiv.off('input', onInput);
133
141
  annotateScrollWarn.update([]);
134
142
  annotateScrollError.update([]);
135
143
  $panelElement.detach();
136
144
  } else {
137
- cm.setOption('lint', {...lintOptions, ...mw.libs.wphl.lintOptions, onUpdateLinting});
145
+ cm.setOption('lint', {...mw.libs.wphl.lintOptions, selfContain: true, onUpdateLinting});
146
+ $lineDiv.on('input', onInput);
138
147
  $panelElement.insertAfter(cm.getWrapperElement());
139
148
  }
140
149
  };
141
150
  cm.setOption('gutters', ['CodeMirror-lint-markers']);
142
151
  switchOption();
143
- cm.addKeyMap(mw.libs.wphl.isPc(CodeMirror)
144
- ? {'Ctrl-K': performLint, 'Ctrl-L': switchOption}
145
- : {'Cmd-K': performLint, 'Cmd-L': switchOption});
146
- cm.on('viewportChange', () => {
147
- if (cm.state.lint) {
148
- clearTimeout(cm.state.lint.timeout);
149
- cm.state.lint.timeout = setTimeout(performLint, cm.state.lint.options.delay);
150
- }
151
- });
152
+ const ctrl = mw.libs.wphl.isPc(CodeMirror) ? 'Ctrl' : 'Cmd';
153
+ cm.addKeyMap({[`${ctrl}-K`]: performLint, [`${ctrl}-L`]: switchOption});
152
154
  cm.on('cursorActivity', () => {
153
155
  positionMap.clear();
154
156
  });
155
157
  };
156
158
 
157
- mw.hook('wiki-codemirror').add(/** @param {CodeMirror.Editor} cm */ cm => {
159
+ /**
160
+ * 分离hook函数以便调试
161
+ * @param {CodeMirror.Editor} cm
162
+ */
163
+ const hook = cm => {
158
164
  if (mw.libs.wphl.addons.has('lint') && cm.getTextArea && cm.getTextArea().id === 'Wikiplus-Quickedit') {
159
165
  lint(cm);
160
166
  }
161
- });
167
+ };
168
+ mw.hook('wiki-codemirror').add(hook);
169
+ mw.libs.wphl.lintHook = hook;
162
170
  })();
package/main.js CHANGED
@@ -9,12 +9,12 @@
9
9
  /* eslint-disable require-unicode-regexp */
10
10
  'use strict';
11
11
 
12
- if (mw.libs.wphl) {
12
+ if (mw.libs.wphl && mw.libs.wphl.version) {
13
13
  return;
14
14
  }
15
- mw.libs.wphl = {}; // 开始加载
15
+ mw.libs.wphl = mw.libs.wphl || {}; // 开始加载
16
16
 
17
- const version = '2.40',
17
+ const version = '2.48.2',
18
18
  newAddon = 0;
19
19
 
20
20
  /** @type {typeof mw.storage} */
@@ -99,7 +99,7 @@
99
99
  const CDN = '//fastly.jsdelivr.net',
100
100
  CM_CDN = 'npm/codemirror@5.65.3',
101
101
  MW_CDN = 'gh/bhsd-harry/codemirror-mediawiki@1.1.6',
102
- PARSER_CDN = 'gh/bhsd-harry/wikiparser-node@0.6.21-b',
102
+ PARSER_CDN = 'gh/bhsd-harry/wikiparser-node@0.7.2-b',
103
103
  REPO_CDN = `npm/wikiplus-highlight@${majorVersion}`;
104
104
 
105
105
  const {config: {values: {
@@ -162,7 +162,7 @@
162
162
  contextmenu: 'mediawiki.Title',
163
163
  lint: `${CM_CDN}/addon/lint/lint.min.js`,
164
164
  annotateScrollbar: `${CM_CDN}/addon/scroll/annotatescrollbar.min.js`,
165
- parser: `${PARSER_CDN}/bundle/bundle.min.js`,
165
+ parser: `${PARSER_CDN}/extensions/editor.min.js`,
166
166
  lintWikitext: `${REPO_CDN}/lint.min.js`,
167
167
  };
168
168
 
@@ -211,9 +211,19 @@
211
211
  const code = c.codePointAt();
212
212
  return code < 256 ? `&#${code};` : `&#x${code.toString(16)};`;
213
213
  }).join('')),
214
- /** @type {function(typeof CodeMirror): boolean} */ isPc = ({keyMap}) => keyMap.default === keyMap.pcDefault,
215
- extraKeysPc = {'Ctrl-/': escapeHTML, 'Ctrl-\\': convert(encodeURIComponent)},
216
- extraKeysMac = {'Cmd-/': escapeHTML, 'Cmd-\\': convert(encodeURIComponent)};
214
+ escapeURI = convert(str => {
215
+ if (str.includes('%')) {
216
+ try {
217
+ return decodeURIComponent(str);
218
+ } catch (e) {}
219
+ }
220
+ return encodeURIComponent(str);
221
+ }),
222
+ /** @type {(cm: typeof CodeMirror) => boolean} */ isPc = ({keyMap}) => keyMap.default === keyMap.pcDefault,
223
+ /** @type {(cm: typeof CodeMirror) => Record<string, (doc: CodeMirror.Editor) => void} */ extraKeys = CM => {
224
+ const ctrl = isPc(CM) ? 'Ctrl' : 'Cmd';
225
+ return {[`${ctrl}-/`]: escapeHTML, [`${ctrl}-\\`]: escapeURI};
226
+ };
217
227
 
218
228
  /**
219
229
  * contextMenu插件
@@ -433,10 +443,10 @@
433
443
  if (!CM.prototype.annotateScrollbar && type === 'mediawiki' && addons.has('lint')) {
434
444
  scripts.push(ADDON_LIST.annotateScrollbar);
435
445
  }
436
- if (!CM.commands.findForward && addons.has('search') && !addons.has('wikiEditor')) {
446
+ if (!CM.commands.find && addons.has('search') && !addons.has('wikiEditor')) {
437
447
  scripts.push(ADDON_LIST.search);
438
448
  }
439
- if (!window.Parser && type === 'mediawiki' && addons.has('lint')) {
449
+ if (!window.wikiparse && type === 'mediawiki' && addons.has('lint')) {
440
450
  scripts.push(ADDON_LIST.parser);
441
451
  }
442
452
  if (!CM.optionHandlers.lint && type === 'mediawiki' && addons.has('lint')) {
@@ -702,7 +712,7 @@
702
712
  ),
703
713
  mode === 'mediawiki'
704
714
  ? {
705
- extraKeys: addons.has('escape') && (isPc(CodeMirror) ? extraKeysPc : extraKeysMac),
715
+ extraKeys: addons.has('escape') && extraKeys(CodeMirror),
706
716
  }
707
717
  : {
708
718
  indentUnit: addons.has('indentWithSpace') ? indent : defaultIndent,
@@ -717,12 +727,10 @@
717
727
  }
718
728
 
719
729
  if (addons.has('wikiEditor')) {
720
- const context = $target.data('wikiEditorContext'),
721
- {keyMap} = CodeMirror,
722
- callback = /** 替代CodeMirror的Ctrl/Cmd-F快捷键 */ () => {
723
- $.wikiEditor.modules.dialogs.api.openDialog(context, 'search-and-replace');
724
- };
725
- cm.addKeyMap(keyMap.default === keyMap.pcDefault ? {'Ctrl-F': callback} : {'Cmd-F': callback});
730
+ const context = $target.data('wikiEditorContext');
731
+ CodeMirror.commands.find = /** 替代CodeMirror的搜索功能 */ () => {
732
+ $.wikiEditor.modules.dialogs.api.openDialog(context, 'search-and-replace');
733
+ };
726
734
  }
727
735
 
728
736
  handleContextMenu(cm, mode);
@@ -746,10 +754,9 @@
746
754
  $('#Wikiplus-Quickedit-MinorEdit').click();
747
755
  $('#Wikiplus-Quickedit-Submit').triggerHandler('click');
748
756
  };
757
+ const ctrl = isPc(CodeMirror) ? 'Ctrl' : 'Cmd';
749
758
  cm.addKeyMap($.extend(
750
- isPc(CodeMirror)
751
- ? {'Ctrl-S': submit, 'Shift-Ctrl-S': submitMinor}
752
- : {'Cmd-S': submit, 'Shift-Cmd-S': submitMinor},
759
+ {[`${ctrl}-S`]: submit, [`Shift-${ctrl}-S`]: submitMinor},
753
760
  escToExitQuickEdit === true || escToExitQuickEdit === 'true'
754
761
  ? {
755
762
  /** 按下Esc键退出编辑 */ Esc() {
@@ -965,7 +972,7 @@
965
972
  }
966
973
  }
967
974
  if (mode === 'mediawiki' && addons.has('escape')) {
968
- doc.addKeyMap(isPc(CodeMirror) ? extraKeysPc : extraKeysMac, true);
975
+ doc.addKeyMap(extraKeys(CodeMirror), true);
969
976
  } else if (mode !== 'mediawiki' && addons.has('indentWithSpace')) {
970
977
  doc.setOption('indentUnit', indent);
971
978
  doc.setOption('indentWithTabs', false);
@@ -983,7 +990,7 @@
983
990
  }
984
991
  });
985
992
 
986
- mw.libs.wphl = {
993
+ Object.assign(mw.libs.wphl, {
987
994
  version,
988
995
  options,
989
996
  addons,
@@ -1005,5 +1012,5 @@
1005
1012
  renderEditor,
1006
1013
  handleOtherEditors,
1007
1014
  isPc,
1008
- }; // 加载完毕
1015
+ }); // 加载完毕
1009
1016
  })();
package/matchtags.js CHANGED
@@ -7,9 +7,8 @@
7
7
  (() => {
8
8
  'use strict';
9
9
 
10
- const {Pos, cmpPos, Init} = CodeMirror;
11
-
12
- const tagStart = /<(\/?)([_a-z]\w*)/giu,
10
+ const {Pos, cmpPos, Init} = CodeMirror,
11
+ tagStart = /<(\/?)([a-z]\w*)(?=[\s/>]|$)/giu,
13
12
  voidTags = new Set(['br', 'wbr', 'hr', 'img']),
14
13
  maxScanLines = 1000;
15
14
 
@@ -19,8 +18,7 @@
19
18
  * @param {CodeMirror.Editor} cm
20
19
  * @param {CodeMirror.Position} pos 当前位置
21
20
  */
22
- constructor(cm, pos) {
23
- const {line, ch} = pos;
21
+ constructor(cm, {line, ch}) {
24
22
  this.line = line;
25
23
  this.ch = ch;
26
24
  this.cm = cm;
@@ -29,14 +27,19 @@
29
27
  this.max = Math.min(line + maxScanLines - 1, cm.lastLine());
30
28
  }
31
29
 
30
+ /** 提取当前位置 */
31
+ get pos() {
32
+ return Pos(this.line, this.ch);
33
+ }
34
+
32
35
  /** 是否是标签 */
33
36
  isTag() {
34
- const type = this.cm.getTokenTypeAt(Pos(this.line, this.ch));
37
+ const type = this.cm.getTokenTypeAt(this.pos);
35
38
  return /\b(?:mw-(?:html|ext)tag|tag\b)/u.test(type);
36
39
  }
37
40
 
38
41
  /**
39
- * 判断是否是括号
42
+ * 判断是否是`<`或`>`
40
43
  * @param {number} ch 列号
41
44
  */
42
45
  bracketAt(ch) {
@@ -69,6 +72,9 @@
69
72
  for (;;) {
70
73
  const gt = this.text.indexOf('>', this.ch);
71
74
  if (gt === -1) {
75
+ if (this.nextLine()) {
76
+ continue;
77
+ }
72
78
  return undefined;
73
79
  }
74
80
  this.ch = gt + 1;
@@ -81,8 +87,11 @@
81
87
  /** Jump to a `<` towards the line start */
82
88
  toTagStart() {
83
89
  for (;;) {
84
- const lt = this.ch ? this.text.lastIndexOf('<', this.ch - 1) : -1;
90
+ const lt = this.ch > 0 ? this.text.lastIndexOf('<', this.ch - 1) : -1;
85
91
  if (lt === -1) {
92
+ if (this.prevLine()) {
93
+ continue;
94
+ }
86
95
  return undefined;
87
96
  } else if (!this.bracketAt(lt)) {
88
97
  this.ch = lt;
@@ -105,9 +114,8 @@
105
114
  if (!found) {
106
115
  if (this.nextLine()) {
107
116
  continue;
108
- } else {
109
- return undefined;
110
117
  }
118
+ return undefined;
111
119
  }
112
120
  this.ch = found.index + found[0].length;
113
121
  if (this.bracketAt(found.index)) {
@@ -119,19 +127,15 @@
119
127
  /** Jump to the end of the first line, or a non-bracket `>`, or the letter after a tag bracket `>` */
120
128
  toPrevTag() {
121
129
  for (;;) {
122
- const gt = this.ch ? this.text.lastIndexOf('>', this.ch - 1) : -1;
130
+ const gt = this.ch > 0 ? this.text.lastIndexOf('>', this.ch - 1) : -1;
123
131
  if (gt === -1) {
124
132
  if (this.prevLine()) {
125
133
  continue;
126
- } else {
127
- return undefined;
128
134
  }
129
- }
130
- if (this.bracketAt(gt)) {
131
- const lastSlash = this.text.lastIndexOf('/', gt);
132
- const selfClose = lastSlash > -1 && !/\S/u.test(this.text.slice(lastSlash + 1, gt));
135
+ return undefined;
136
+ } else if (this.bracketAt(gt)) {
133
137
  this.ch = gt + 1;
134
- return selfClose ? 'selfClose' : 'regular';
138
+ return this.text[gt - 1] === '/' ? 'selfClose' : 'regular';
135
139
  }
136
140
  this.ch = gt;
137
141
  }
@@ -150,7 +154,7 @@
150
154
  if (!next) {
151
155
  return undefined;
152
156
  }
153
- const start = this.ch - next[0].length,
157
+ const from = Pos(this.line, this.ch - next[0].length),
154
158
  end = this.toTagEnd(),
155
159
  tagName = next[2].toLowerCase();
156
160
  if (!end) {
@@ -166,7 +170,7 @@
166
170
  }
167
171
  }
168
172
  if (i < 0 && (!tag || tag === tagName)) {
169
- return {tag: tagName, from: Pos(this.line, start), to: Pos(this.line, this.ch)};
173
+ return {tag: tagName, from, to: this.pos};
170
174
  }
171
175
  } else { // opening tag
172
176
  stack.push(tagName);
@@ -187,7 +191,7 @@
187
191
  if (!prev) {
188
192
  return undefined;
189
193
  }
190
- const {ch: end} = this,
194
+ const {pos: to} = this,
191
195
  start = this.toTagStart();
192
196
  if (!start) {
193
197
  return undefined;
@@ -206,7 +210,7 @@
206
210
  }
207
211
  }
208
212
  if (i < 0 && (!tag || tag === tagName)) {
209
- return {tag: tagName, from: Pos(this.line, this.ch), to: Pos(this.line, end)};
213
+ return {tag: tagName, from: this.pos, to};
210
214
  }
211
215
  }
212
216
  }
@@ -222,27 +226,25 @@
222
226
  * @returns {CodeMirror.MatchingTagPair}
223
227
  */
224
228
  function(pos) {
225
- let iter = new Iter(this, pos);
229
+ const iter = new Iter(this, pos);
226
230
  if (!iter.isTag()) {
227
231
  return undefined;
228
232
  }
229
233
  const end = iter.toTagEnd(),
230
- to = end && Pos(iter.line, iter.ch);
231
- const start = end && iter.toTagStart();
234
+ to = end && iter.pos,
235
+ start = end && iter.toTagStart();
232
236
  if (!start || cmpPos(iter, pos) > 0) {
233
237
  return undefined;
234
238
  }
235
239
  const tag = start[2].toLowerCase(),
236
- here = {from: Pos(iter.line, iter.ch), to, tag};
240
+ here = {from: iter.pos, to, tag};
237
241
  if (end === 'selfClose' || voidTags.has(tag)) {
238
- return {open: here, close: null, loc: 'self'};
239
- }
240
-
241
- if (start[1]) { // closing tag
242
+ return {open: here, loc: 'self'};
243
+ } else if (start[1]) { // closing tag
242
244
  return {open: iter.findMatchingOpen(tag), close: here, loc: 'close'};
243
- } // opening tag
244
- iter = new Iter(this, to);
245
- return {open: here, close: iter.findMatchingClose(tag), loc: 'open'};
245
+ }
246
+ // opening tag
247
+ return {open: here, close: new Iter(this, to).findMatchingClose(tag), loc: 'open'};
246
248
  },
247
249
  );
248
250
 
@@ -256,22 +258,17 @@
256
258
  * @returns {CodeMirror.MatchingTagPair}
257
259
  */
258
260
  function(pos, tag) {
259
- const iter = new Iter(this, pos),
260
- open = iter.findMatchingOpen(tag);
261
- if (!open) {
262
- return undefined;
261
+ const open = new Iter(this, pos).findMatchingOpen(tag);
262
+ if (open) {
263
+ const close = new Iter(this, pos).findMatchingClose(open.tag);
264
+ return close && {open, close};
263
265
  }
264
- const forward = new Iter(this, pos),
265
- close = forward.findMatchingClose(open.tag);
266
- return close ? {open, close} : undefined;
266
+ return undefined;
267
267
  },
268
268
  );
269
269
 
270
270
  /** Used by addon/edit/closetag.js */
271
- CodeMirror.scanForClosingTag = (cm, pos, tagName) => {
272
- const iter = new Iter(cm, pos);
273
- return iter.findMatchingClose(tagName);
274
- };
271
+ CodeMirror.scanForClosingTag = (cm, pos, tagName) => new Iter(cm, pos).findMatchingClose(tagName);
275
272
 
276
273
  CodeMirror.defineOption('matchTags', false, (cm, val, old) => {
277
274
  if (old && old !== Init) {
@@ -291,12 +288,12 @@
291
288
  const clear = cm => {
292
289
  if (cm.state.tagHit) {
293
290
  cm.state.tagHit.clear();
291
+ cm.state.tagHit = undefined;
294
292
  }
295
293
  if (cm.state.tagOther) {
296
294
  cm.state.tagOther.clear();
295
+ cm.state.tagOther = undefined;
297
296
  }
298
- cm.state.tagHit = null;
299
- cm.state.tagOther = null;
300
297
  };
301
298
 
302
299
  /**
@@ -320,9 +317,9 @@
320
317
  other = match.loc === 'close' ? match.open : match.close;
321
318
  if (hit) {
322
319
  cm.state.tagHit = cm.markText(hit.from, hit.to, {className: `cm-${other ? '' : 'non'}matchingtag`});
323
- }
324
- if (other) {
325
- cm.state.tagOther = cm.markText(other.from, other.to, {className: 'cm-matchingtag'});
320
+ if (other) {
321
+ cm.state.tagOther = cm.markText(other.from, other.to, {className: 'cm-matchingtag'});
322
+ }
326
323
  }
327
324
  });
328
325
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiplus-highlight",
3
- "version": "2.40.0",
3
+ "version": "2.48.2",
4
4
  "description": "A plugin for the MediaWiki front-end add-on \"Wikiplus\"",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -24,8 +24,7 @@
24
24
  "url": "git+https://github.com/bhsd-harry/Wikiplus-highlight.git"
25
25
  },
26
26
  "scripts": {
27
- "test": "http-server -c-1 --cors",
28
- "ssl": "http-server -c-1 -S -C cert.pem"
27
+ "test": "eslint . && http-server -c-1 --cors"
29
28
  },
30
29
  "devDependencies": {
31
30
  "eslint": "^8.8.0",
package/search.js CHANGED
@@ -5,28 +5,26 @@
5
5
  /* eslint-disable require-unicode-regexp */
6
6
  (() => {
7
7
  'use strict';
8
-
9
- /**
10
- * I18N消息
11
- * @param {string} key 消息键
12
- */
13
- const msg = key => mw.msg(`wphl-${key}`);
8
+ const {Pos} = CodeMirror,
9
+ {libs: {wphl: {msg, isPc, addons}}} = mw;
14
10
 
15
11
  // Prepare elements
16
12
  const $search = $('<input>', {class: 'Wikiplus-Quickedit-Search', placeholder: msg('search-placeholder')}),
17
- $searchClose = $('<span>', {text: '×', id: 'Wikiplus-Quickedit-Search-Close', class: 'Wikiplus-Symbol-Btn'}),
18
- $searchNext = $('<span>', {text: '▼', id: 'Wikiplus-Quickedit-Search-Next', class: 'Wikiplus-Symbol-Btn'}),
19
- $searchPrev = $('<span>', {text: '▲', id: 'Wikiplus-Quickedit-Search-Prev', class: 'Wikiplus-Symbol-Btn'}),
13
+ $searchClose = $('<span>', {text: '×', class: 'Wikiplus-Symbol-Btn'}),
14
+ $searchNext = $('<span>', {text: '▼', class: 'Wikiplus-Symbol-Btn'}),
15
+ $searchPrev = $('<span>', {text: '▲', class: 'Wikiplus-Symbol-Btn'}),
20
16
  $searchContainer = $('<div>', {
21
17
  class: 'Wikiplus-Quickedit-Search-Div',
22
18
  html: [$search, $searchNext, $searchPrev, $searchClose],
23
19
  }),
24
20
  $searchBtn = $('<span>', {class: 'Wikiplus-Btn', html: msg('addon-search')}),
25
21
  $replace = $('<input>', {class: 'Wikiplus-Quickedit-Search', placeholder: msg('replace-placeholder')}),
26
- $replaceClose = $('<span>', {text: '×', id: 'Wikiplus-Quickedit-Replace-Close', class: 'Wikiplus-Symbol-Btn'}),
22
+ $replaceClose = $('<span>', {text: '×', class: 'Wikiplus-Symbol-Btn'}),
23
+ $replaceNext = $('<span>', {text: '▼', class: 'Wikiplus-Symbol-Btn'}),
24
+ $replacePrev = $('<span>', {text: '▲', class: 'Wikiplus-Symbol-Btn'}),
27
25
  $replaceContainer = $('<div>', {
28
26
  class: 'Wikiplus-Quickedit-Search-Div',
29
- html: [$replace, $replaceClose],
27
+ html: [$replace, $replaceNext, $replacePrev, $replaceClose],
30
28
  }),
31
29
  $replaceBtn = $('<span>', {class: 'Wikiplus-Btn', html: msg('search-replace')});
32
30
 
@@ -38,7 +36,7 @@
38
36
  * @param {string|RegExp} str 搜索字符串
39
37
  */
40
38
  const token = str => {
41
- const initial = typeof str === 'string' ? new RegExp(`[^${escapeRegExp(str[0])}]`, 'i') : null;
39
+ const initial = typeof str === 'string' && new RegExp(`[^${escapeRegExp(str[0])}]`, 'i');
42
40
 
43
41
  /**
44
42
  * @override
@@ -61,36 +59,55 @@
61
59
  $search.css('background-color', '').off('input', onInput);
62
60
  };
63
61
 
64
- let /** @type {string|RegExp} */ lastPtn,
62
+ let /** @type {string} */ lastSource,
63
+ /** @type {string|RegExp} */ lastPtn,
65
64
  /** @type {CodeMirror.SearchCursor} */ cursor;
65
+
66
+ /**
67
+ * 更新搜索字符串
68
+ * @param {CodeMirror.Editor} cm
69
+ */
70
+ const updatePtn = cm => {
71
+ const /** @type {string} */ source = $search.val();
72
+ if (!source) {
73
+ return undefined;
74
+ } else if (source === lastSource) {
75
+ return lastPtn;
76
+ }
77
+ const caseFold = source.endsWith('i'),
78
+ ptn = /^\/.+\/i?$/u.test(source)
79
+ ? new RegExp(source.slice(1, caseFold ? -2 : -1), caseFold ? 'im' : 'm')
80
+ : source;
81
+ cm.removeOverlay(overlay);
82
+ overlay.token = token(ptn);
83
+ cm.addOverlay(overlay);
84
+ lastSource = source;
85
+ lastPtn = ptn;
86
+ cursor = cm.getSearchCursor(ptn, cm.getCursor(), {caseFold: true});
87
+ return ptn;
88
+ };
89
+
66
90
  /**
67
91
  * keyboard event handler of `$search`
68
92
  * @param {CodeMirror.Editor} cm
69
93
  * @param {boolean} dir 搜索方向
94
+ * @param {boolean} update 是否先更新搜索字符串
70
95
  */
71
- const findNext = (cm, dir) => {
72
- let /** @type {string|RegExp} */ ptn = $search.val();
73
- if (!ptn) {
96
+ const findNext = (cm, dir, update = true) => {
97
+ if (update && !updatePtn(cm)) {
74
98
  return;
75
- } else if (typeof ptn === 'string' && /^\/.+\/i?$/u.test(ptn)) {
76
- ptn = new RegExp(ptn.slice(1, -2), ptn.endsWith('i') ? 'im' : 'm');
77
- }
78
- if (ptn !== lastPtn) {
79
- cm.removeOverlay(overlay);
80
- overlay.token = token(ptn);
81
- cm.addOverlay(overlay);
82
- lastPtn = ptn;
83
- cursor = cm.getSearchCursor(ptn, cm.getCursor(), {caseFold: true});
84
99
  }
85
100
  let result = dir ? cursor.findNext() : cursor.findPrevious();
86
101
  if (!result) {
102
+ let pos;
87
103
  if (dir) {
88
- cursor = cm.getSearchCursor(ptn, {line: 0, ch: 0}, {caseFold: true});
104
+ pos = Pos(0, 0);
89
105
  } else {
90
- const lastLine = cm.lastLine(),
91
- {length: lastCh} = cm.getLine(lastLine);
92
- cursor = cm.getSearchCursor(ptn, {line: lastLine, ch: lastCh}, {caseFold: true});
106
+ const lastLine = cm.lastLine();
107
+ pos = Pos(lastLine, cm.getLine(lastLine).length);
93
108
  }
109
+ cursor.pos = {from: pos, to: pos};
110
+ cursor.atOccurrence = false;
94
111
  result = dir ? cursor.findNext() : cursor.findPrevious();
95
112
  }
96
113
  if (result) {
@@ -104,35 +121,39 @@
104
121
  }
105
122
  };
106
123
 
124
+ /**
125
+ * replace one by one
126
+ * @param {CodeMirror.Editor} cm
127
+ * @param {boolean} dir 搜索方向
128
+ */
129
+ const replaceNext = (cm, dir) => {
130
+ const ptn = updatePtn(cm);
131
+ if (!ptn) {
132
+ return;
133
+ } else if (cursor.atOccurrence) {
134
+ const replace = $replace.val();
135
+ cursor.replace(typeof ptn === 'string' ? replace : cursor.pos.match[0].replace(ptn, replace));
136
+ }
137
+ findNext(cm, dir, false);
138
+ };
139
+
107
140
  /**
108
141
  * keyboard event handler of `$replace`
109
142
  * @param {CodeMirror.Editor} cm
110
143
  */
111
144
  const replace = async cm => {
112
- let /** @type {string|RegExp} */ ptn = $search.val();
145
+ const ptn = updatePtn(cm);
113
146
  if (!ptn) {
114
147
  return;
115
- } else if (typeof ptn === 'string' && /^\/.+\/i?$/u.test(ptn)) {
116
- ptn = new RegExp(ptn.slice(1, -2), ptn.endsWith('i') ? 'im' : 'm');
117
- }
118
- if (ptn !== lastPtn) {
119
- cm.removeOverlay(overlay);
120
- overlay.token = token(ptn);
121
- cm.addOverlay(overlay);
122
- lastPtn = ptn;
123
- cursor = cm.getSearchCursor(ptn, cm.getCursor(), {caseFold: true});
124
148
  }
125
149
  const replacePtn = typeof ptn === 'string'
126
150
  ? new RegExp(escapeRegExp(ptn), 'gim')
127
151
  : new RegExp(ptn, `g${ptn.flags}`),
128
152
  val = cm.getValue(),
129
153
  mt = val.match(replacePtn);
130
- if (mt) {
131
- const bool = await OO.ui.confirm(mw.libs.wphl.msg('replace-count', mt.length));
132
- if (bool) {
133
- cm.setValue(val.replace(replacePtn, $replace.val()));
134
- $replaceContainer.hide();
135
- }
154
+ if (mt && await OO.ui.confirm(msg('replace-count', mt.length))) {
155
+ cm.setValue(val.replace(replacePtn, $replace.val()));
156
+ $replaceContainer.hide();
136
157
  }
137
158
  };
138
159
 
@@ -159,21 +180,26 @@
159
180
  cm.removeOverlay(overlay);
160
181
  $searchContainer.hide();
161
182
  $replaceContainer.hide();
162
- lastPtn = '';
183
+ lastSource = '';
163
184
  };
164
185
 
165
- CodeMirror.commands.findForward = /** 向后搜索 */ doc => {
186
+ CodeMirror.commands.find = findNew;
187
+ CodeMirror.commands.findNext = /** 向后搜索 */ doc => {
166
188
  findNext(doc, true);
167
189
  };
168
- CodeMirror.commands.findBackward = /** 向前搜索 */ doc => {
190
+ CodeMirror.commands.findPrev = /** 向前搜索 */ doc => {
169
191
  findNext(doc, false);
170
192
  };
171
- CodeMirror.commands.replace = /** 全部替换 */ doc => {
193
+ CodeMirror.commands.replace = replaceNew;
194
+ CodeMirror.commands.replaceNext = /** 向后替换 */ doc => {
195
+ replaceNext(doc, true);
196
+ };
197
+ CodeMirror.commands.replaceAll = /** 全文替换 */ doc => { // eslint-disable-line es-x/no-string-prototype-replaceall
172
198
  replace(doc);
173
199
  };
174
200
 
175
201
  mw.hook('wiki-codemirror').add(/** @param {CodeMirror.Editor} cm */ cm => {
176
- if (!cm.getOption('styleSelectedText') || mw.libs.wphl.addons.has('wikiEditor')) {
202
+ if (!cm.getOption('styleSelectedText') || addons.has('wikiEditor')) {
177
203
  return;
178
204
  }
179
205
  const $textarea = $(cm.getWrapperElement()).prev('#Wikiplus-Quickedit');
@@ -205,6 +231,12 @@
205
231
  $replaceClose.click(() => {
206
232
  $replaceContainer.hide();
207
233
  });
234
+ $replaceNext.click(() => {
235
+ replaceNext(cm, true);
236
+ });
237
+ $replacePrev.click(() => {
238
+ replaceNext(cm, false);
239
+ });
208
240
  $replace.val('').keydown(e => {
209
241
  if (e.key === 'Enter') {
210
242
  e.preventDefault();
@@ -214,23 +246,12 @@
214
246
  $replaceContainer.hide();
215
247
  }
216
248
  });
217
- cm.addKeyMap(
218
- CodeMirror.keyMap.default === CodeMirror.keyMap.pcDefault
219
- ? {
220
- 'Ctrl-F': findNew,
221
- 'Ctrl-G': 'findForward',
222
- 'Shift-Ctrl-G': 'findBackward',
223
- 'Shift-Ctrl-F': replaceNew,
224
- 'Shift-Ctrl-R': 'replace',
225
- }
226
- : {
227
- 'Cmd-F': findNew,
228
- 'Cmd-G': 'findForward',
229
- 'Shift-Cmd-G': 'findBackward',
230
- 'Cmd-Alt-F': replaceNew,
231
- 'Shift-Cmd-Alt-F': 'replace',
232
- },
233
- );
249
+ const ctrl = isPc(CodeMirror) ? 'Ctrl' : 'Cmd';
250
+ cm.addKeyMap({
251
+ [`${ctrl}-H`]: 'replace',
252
+ [`Shift-${ctrl}-H`]: 'replaceNext',
253
+ [`${ctrl}-Alt-Enter`]: 'replaceAll',
254
+ });
234
255
  });
235
256
 
236
257
  mw.loader.addStyleTag(