diff --git a/js/build/linkit.js b/js/build/linkit.js index 706733a31fd5bf91bec092740ed88ea3fd05abaa..153add51ce4ff21be7bffc61d787ab1fe0578fb2 100644 --- a/js/build/linkit.js +++ b/js/build/linkit.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CKEditor5=e():(t.CKEditor5=t.CKEditor5||{},t.CKEditor5.linkit=e())}(self,()=>(()=>{var t={"ckeditor5/src/core.js":(t,e,i)=>{t.exports=i("dll-reference CKEditor5.dll")("./src/core.js")},"ckeditor5/src/typing.js":(t,e,i)=>{t.exports=i("dll-reference CKEditor5.dll")("./src/typing.js")},"dll-reference CKEditor5.dll":t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};return(()=>{"use strict";i.d(n,{default:()=>u});var t=i("ckeditor5/src/core.js"),e=i("ckeditor5/src/typing.js");class s extends t.Plugin{init(){this.attrs=["linkDataEntityType","linkDataEntityUuid","linkDataEntitySubstitution"],this.attrsView=["data-entity-type","data-entity-uuid","data-entity-substitution"],this._allowAndConvertExtraAttributes(),this._removeExtraAttributesOnUnlinkCommandExecute(),this._refreshExtraAttributeValues(),this._addExtraAttributesOnLinkCommandExecute()}_allowAndConvertExtraAttributes(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:this.attrs}),this.attrs.forEach((e,i)=>{t.conversion.for("downcast").attributeToElement({model:e,view:(t,{writer:e})=>{const n=e.createAttributeElement("a",{[this.attrsView[i]]:t},{priority:5});return e.setCustomProperty("link",!0,n),n}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{[this.attrsView[i]]:!0}},model:{key:e,value:t=>t.getAttribute(this.attrsView[i])}})})}_addExtraAttributesOnLinkCommandExecute(){const t=this.editor,e=t.commands.get("link");let i=!1;e.on("execute",(e,n)=>{if(i)return void(i=!1);e.stop(),i=!0;const s=n[1],o=this.editor.model,r=o.document.selection;o.change(e=>{t.execute("link",...n);const i=r.getFirstPosition();this.attrs.forEach(t=>{if(r.isCollapsed){const n=i.textNode||i.nodeBefore;s[t]?e.setAttribute(t,s[t],e.createRangeOn(n)):e.removeAttribute(t,e.createRangeOn(n)),e.removeSelectionAttribute(t)}else{const i=o.schema.getValidRanges(r.getRanges(),t);for(const n of i)s[t]?e.setAttribute(t,s[t],n):e.removeAttribute(t,n)}})})},{priority:"high"})}_removeExtraAttributesOnUnlinkCommandExecute(){const t=this.editor,i=t.commands.get("unlink"),n=this.editor.model,s=n.document.selection;let o=!1;i.on("execute",i=>{o||(i.stop(),n.change(()=>{o=!0,t.execute("unlink"),o=!1,n.change(t=>{let i;this.attrs.forEach(o=>{i=s.isCollapsed?[(0,e.findAttributeRange)(s.getFirstPosition(),o,s.getAttribute(o),n)]:n.schema.getValidRanges(s.getRanges(),o);for(const e of i)t.removeAttribute(o,e)})})}))},{priority:"high"})}_refreshExtraAttributeValues(){const t=this.editor,e=this.attrs,i=t.commands.get("link"),n=this.editor.model,s=n.document.selection;e.forEach(t=>{i.set(t,null)}),n.document.on("change",()=>{e.forEach(t=>{i[t]=s.getAttribute(t)})})}static get pluginName(){return"LinkitEditing"}}const o=jQuery;function r(t,e){var i=o("