@ckeditor/ckeditor5-link 37.0.0-alpha.0 → 37.0.0-alpha.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/build/link.js +1 -1
- package/package.json +23 -23
- package/src/augmentation.d.ts +30 -0
- package/src/augmentation.js +5 -0
- package/src/autolink.d.ts +0 -5
- package/src/index.d.ts +4 -0
- package/src/index.js +3 -0
- package/src/link.d.ts +0 -6
- package/src/link.js +0 -1
- package/src/linkcommand.d.ts +7 -11
- package/src/linkcommand.js +7 -6
- package/src/linkconfig.d.ts +0 -10
- package/src/linkediting.d.ts +5 -11
- package/src/linkediting.js +5 -6
- package/src/linkimage.d.ts +0 -5
- package/src/linkimageediting.d.ts +2 -7
- package/src/linkimageediting.js +2 -2
- package/src/linkimageui.d.ts +0 -5
- package/src/linkui.d.ts +2 -7
- package/src/linkui.js +2 -2
- package/src/ui/linkactionsview.d.ts +4 -4
- package/src/ui/linkformview.d.ts +4 -4
- package/src/unlinkcommand.d.ts +1 -6
- package/src/unlinkcommand.js +1 -1
- package/src/utils/automaticdecorators.d.ts +4 -3
- package/src/utils/automaticdecorators.js +4 -3
- package/src/utils/manualdecorator.d.ts +2 -2
- package/src/utils/manualdecorator.js +2 -2
- package/src/utils.d.ts +4 -4
- package/src/utils.js +4 -4
package/build/link.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={23:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-link_selected span.image-inline{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}",""]);const s=o},952:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{color:var(--ck-color-link-default);cursor:pointer;max-width:var(--ck-input-width);min-width:3em;padding:0 var(--ck-spacing-medium);text-align:center;text-overflow:ellipsis}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{max-width:100%;min-width:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}",""]);const s=o},893:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{min-width:var(--ck-input-width);padding:0}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical>.ck-button{border-radius:0;margin:0;padding:var(--ck-spacing-standard);width:50%}.ck.ck-link-form_layout-vertical>.ck-button:not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form_layout-vertical>.ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical>.ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}",""]);const s=o},269:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck.ck-editor__editable a span.image-inline:after,.ck.ck-editor__editable figure.image>a:after{display:block;position:absolute}:root{--ck-link-image-indicator-icon-size:20;--ck-link-image-indicator-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck.ck-editor__editable a span.image-inline:after,.ck.ck-editor__editable figure.image>a:after{background-color:rgba(0,0,0,.4);background-image:url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTExLjA3NyAxNSAuOTkxLTEuNDE2YS43NS43NSAwIDEgMSAxLjIyOS44NmwtMS4xNDggMS42NGEuNzQ4Ljc0OCAwIDAgMS0uMjE3LjIwNiA1LjI1MSA1LjI1MSAwIDAgMS04LjUwMy01Ljk1NS43NDEuNzQxIDAgMCAxIC4xMi0uMjc0bDEuMTQ3LTEuNjM5YS43NS43NSAwIDEgMSAxLjIyOC44Nkw0LjkzMyAxMC43bC4wMDYuMDAzYTMuNzUgMy43NSAwIDAgMCA2LjEzMiA0LjI5NGwuMDA2LjAwNHptNS40OTQtNS4zMzVhLjc0OC43NDggMCAwIDEtLjEyLjI3NGwtMS4xNDcgMS42MzlhLjc1Ljc1IDAgMSAxLTEuMjI4LS44NmwuODYtMS4yM2EzLjc1IDMuNzUgMCAwIDAtNi4xNDQtNC4zMDFsLS44NiAxLjIyOWEuNzUuNzUgMCAwIDEtMS4yMjktLjg2bDEuMTQ4LTEuNjRhLjc0OC43NDggMCAwIDEgLjIxNy0uMjA2IDUuMjUxIDUuMjUxIDAgMCAxIDguNTAzIDUuOTU1em0tNC41NjMtMi41MzJhLjc1Ljc1IDAgMCAxIC4xODQgMS4wNDVsLTMuMTU1IDQuNTA1YS43NS43NSAwIDEgMS0xLjIyOS0uODZsMy4xNTUtNC41MDZhLjc1Ljc1IDAgMCAxIDEuMDQ1LS4xODR6Ii8+PC9zdmc+");background-position:50%;background-repeat:no-repeat;background-size:14px;border-radius:100%;content:"";height:calc(var(--ck-link-image-indicator-icon-is-visible)*var(--ck-link-image-indicator-icon-size));overflow:hidden;right:min(var(--ck-spacing-medium),6%);top:min(var(--ck-spacing-medium),6%);width:calc(var(--ck-link-image-indicator-icon-is-visible)*var(--ck-link-image-indicator-icon-size))}',""]);const s=o},764:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}',""]);const s=o},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i=e(t);return t[2]?"@media ".concat(t[2]," {").concat(i,"}"):i})).join("")},t.i=function(e,i,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var s=0;s<this.length;s++){var r=this[s][0];null!=r&&(o[r]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);n&&o[c[0]]||(i&&(c[2]?c[2]="".concat(i," and ").concat(c[2]):c[2]=i),t.push(c))}},t}},62:(e,t,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},s=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),r=[];function a(e){for(var t=-1,i=0;i<r.length;i++)if(r[i].identifier===e){t=i;break}return t}function c(e,t){for(var i={},n=[],o=0;o<e.length;o++){var s=e[o],c=t.base?s[0]+t.base:s[0],l=i[c]||0,u="".concat(c," ").concat(l);i[c]=l+1;var d=a(u),k={css:s[1],media:s[2],sourceMap:s[3]};-1!==d?(r[d].references++,r[d].updater(k)):r.push({identifier:u,updater:g(k,t),references:1}),n.push(u)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var r=s(e.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}return t}var u,d=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function k(e,t,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var s=document.createTextNode(o),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(s,r[t]):e.appendChild(s)}}function h(e,t,i){var n=i.css,o=i.media,s=i.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,m=0;function g(e,t){var i,n,o;if(t.singleton){var s=m++;i=f||(f=l(t)),n=k.bind(null,i,s,!1),o=k.bind(null,i,s,!0)}else i=l(t),n=h.bind(null,i,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var i=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var o=a(i[n]);r[o].references--}for(var s=c(e,t),l=0;l<i.length;l++){var u=a(i[l]);0===r[u].references&&(r[u].updater(),r.splice(u,1))}i=s}}}},945:(e,t,i)=>{e.exports=i(79)("./src/clipboard.js")},704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},492:(e,t,i)=>{e.exports=i(79)("./src/engine.js")},181:(e,t,i)=>{e.exports=i(79)("./src/typing.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},995:(e,t,i)=>{e.exports=i(79)("./src/widget.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={id:n,exports:{}};return e[n](s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var n={};(()=>{"use strict";i.r(n),i.d(n,{AutoLink:()=>Pe,Link:()=>Fe,LinkEditing:()=>pe,LinkImage:()=>$e,LinkImageEditing:()=>Re,LinkImageUI:()=>qe,LinkUI:()=>je});var e=i(704),t=i(492),o=i(181),s=i(945),r=i(209);class a{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((e=>this._definitions.add(e))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!i.schema.isInline(t.item))return;const n=i.writer,o=n.document.selection;for(const e of this._definitions){const s=n.createAttributeElement("a",e.attributes,{priority:5});e.classes&&n.addClass(e.classes,s);for(const t in e.styles)n.setStyle(t,e.styles[t],s);n.setCustomProperty("link",!0,s),e.callback(t.attributeNewValue)?t.item.is("selection")?n.wrap(o.getFirstRange(),s):n.wrap(i.mapper.toViewRange(t.range),s):n.unwrap(i.mapper.toViewRange(t.range),s)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((e,t,{writer:i,mapper:n})=>{const o=n.toViewElement(t.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));for(const e of this._definitions){const n=(0,r.toMap)(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of n)"class"===e?i.addClass(t,s):i.setAttribute(e,t,s);e.classes&&i.addClass(e.classes,s);for(const t in e.styles)i.setStyle(t,e.styles[t],s)}else{for(const[e,t]of n)"class"===e?i.removeClass(t,s):i.removeAttribute(e,s);e.classes&&i.removeClass(e.classes,s);for(const t in e.styles)i.removeStyle(t,s)}}}))}}}const c=function(e,t,i){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(i=i>o?o:i)<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(o);++n<o;)s[n]=e[n+t];return s};const l=function(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:c(e,t,i)};var u=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const d=function(e){return u.test(e)};const k=function(e){return e.split("")};var h="\\ud800-\\udfff",f="["+h+"]",m="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",g="\\ud83c[\\udffb-\\udfff]",b="[^"+h+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",v="(?:"+m+"|"+g+")"+"?",_="[\\ufe0e\\ufe0f]?",y=_+v+("(?:\\u200d(?:"+[b,p,w].join("|")+")"+_+v+")*"),A="(?:"+[b+m+"?",m,p,w,f].join("|")+")",x=RegExp(g+"(?="+g+")|"+A+y,"g");const I=function(e){return e.match(x)||[]};const V=function(e){return d(e)?I(e):k(e)};const S="object"==typeof global&&global&&global.Object===Object&&global;var T="object"==typeof self&&self&&self.Object===Object&&self;const E=(S||T||Function("return this")()).Symbol;const L=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o};const C=Array.isArray;var D=Object.prototype,M=D.hasOwnProperty,j=D.toString,B=E?E.toStringTag:void 0;const N=function(e){var t=M.call(e,B),i=e[B];try{e[B]=void 0;var n=!0}catch(e){}var o=j.call(e);return n&&(t?e[B]=i:delete e[B]),o};var H=Object.prototype.toString;const O=function(e){return H.call(e)};var P="[object Null]",U="[object Undefined]",F=E?E.toStringTag:void 0;const R=function(e){return null==e?void 0===e?U:P:F&&F in Object(e)?N(e):O(e)};const z=function(e){return null!=e&&"object"==typeof e};var Z="[object Symbol]";const q=function(e){return"symbol"==typeof e||z(e)&&R(e)==Z};var K=1/0,Q=E?E.prototype:void 0,$=Q?Q.toString:void 0;const W=function e(t){if("string"==typeof t)return t;if(C(t))return L(t,e)+"";if(q(t))return $?$.call(t):"";var i=t+"";return"0"==i&&1/t==-K?"-0":i};const Y=function(e){return null==e?"":W(e)};const G=function(e){return function(t){t=Y(t);var i=d(t)?V(t):void 0,n=i?i[0]:t.charAt(0),o=i?l(i,1).join(""):t.slice(1);return n[e]()+o}}("toUpperCase"),J=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,X=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,ee=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,te=/^((\w+:(\/{2,})?)|(\W))/i,ie="Ctrl+K";function ne(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function oe(e){const t=String(e);return function(e){const t=e.replace(J,"");return!!t.match(X)}(t)?t:"#"}function se(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function re(e,t){const i=(n=e,ee.test(n)?"mailto:":t);var n;const o=!!i&&!ae(e);return e&&o?i+e:e}function ae(e){return te.test(e)}function ce(e){window.open(e,"_blank","noopener")}class le extends e.Command{constructor(){super(...arguments),this.manualDecorators=new r.Collection,this.automaticDecorators=new a}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||(0,r.first)(t.getSelectedBlocks());se(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,n=i.document.selection,s=[],a=[];for(const e in t)t[e]?s.push(e):a.push(e);i.change((t=>{if(n.isCollapsed){const c=n.getFirstPosition();if(n.hasAttribute("linkHref")){const r=(0,o.findAttributeRange)(c,"linkHref",n.getAttribute("linkHref"),i);t.setAttribute("linkHref",e,r),s.forEach((e=>{t.setAttribute(e,!0,r)})),a.forEach((e=>{t.removeAttribute(e,r)})),t.setSelection(t.createPositionAfter(r.end.nodeBefore))}else if(""!==e){const o=(0,r.toMap)(n.getAttributes());o.set("linkHref",e),s.forEach((e=>{o.set(e,!0)}));const{end:a}=i.insertContent(t.createText(e,o),c);t.setSelection(a)}["linkHref",...s,...a].forEach((e=>{t.removeSelectionAttribute(e)}))}else{const o=i.schema.getValidRanges(n.getRanges(),"linkHref"),r=[];for(const e of n.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&r.push(t.createRangeOn(e));const c=r.slice();for(const e of o)this._isRangeToUpdate(e,r)&&c.push(e);for(const i of c)t.setAttribute("linkHref",e,i),s.forEach((e=>{t.setAttribute(e,!0,i)})),a.forEach((e=>{t.removeAttribute(e,i)}))}}))}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return se(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}class ue extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();se(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change((e=>{const s=i.isCollapsed?[(0,o.findAttributeRange)(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),n)for(const i of n.manualDecorators)e.removeAttribute(i.id,t)}))}}class de extends((0,r.ObservableMixin)()){constructor({id:e,label:t,attributes:i,classes:n,styles:o,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=i,this.classes=n,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var ke=i(62),he=i.n(ke),fe=i(23),me={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(fe.Z,me);fe.Z.locals;const ge="automatic",be=/^(https?:)?\/\//;class pe extends e.Plugin{static get pluginName(){return"LinkEditing"}static get requires(){return[o.TwoStepCaretMovement,o.Input,s.ClipboardPipeline]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:ne}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>ne(oe(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new le(e)),e.commands.add("unlink",new ue(e));const t=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach((e=>("label"in e&&i[e.label]&&(e.label=i[e.label]),e))),t}(e.t,function(e){const t=[];if(e)for(const[i,n]of Object.entries(e)){const e=Object.assign({},n,{id:`link${G(i)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter((e=>e.mode===ge))),this._enableManualDecorators(t.filter((e=>"manual"===e.mode)));e.plugins.get(o.TwoStepCaretMovement).registerAttribute("linkHref"),(0,o.inlineHighlight)(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:ge,callback:e=>!!e&&be.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach((e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const n=new de(e);i.add(n),t.conversion.for("downcast").attributeToElement({model:n.id,view:(e,{writer:t,schema:i},{item:o})=>{if((o.is("selection")||i.isInline(o))&&e){const e=t.createAttributeElement("a",n.attributes,{priority:5});n.classes&&t.addClass(n.classes,e);for(const i in n.styles)t.setStyle(i,n.styles[i],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}})}))}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((e,t)=>{if(!(r.env.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let i=t.domTarget;if("a"!=i.tagName.toLowerCase()&&(i=i.closest("a")),!i)return;const n=i.getAttribute("href");n&&(e.stop(),t.preventDefault(),ce(n))}),{context:"$capture"}),this.listenTo(t,"keydown",((t,i)=>{const n=e.commands.get("link").value;!!n&&i.keyCode===r.keyCodes.enter&&i.altKey&&(t.stop(),ce(n))}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",(()=>{const i=t.anchor.nodeBefore,n=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(n&&n.hasAttribute("linkHref")||e.change((t=>{we(t,_e(e.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,i=e.model;e.editing.view.addObserver(t.MouseObserver);let n=!1;this.listenTo(e.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(e.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const e=i.document.selection;if(!e.isCollapsed)return;if(!e.hasAttribute("linkHref"))return;const t=e.getFirstPosition(),s=(0,o.findAttributeRange)(t,"linkHref",e.getAttribute("linkHref"),i);(t.isTouching(s.start)||t.isTouching(s.end))&&i.change((e=>{we(e,_e(i.schema))}))}))}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i=null,n=!1;this.listenTo(t.document,"delete",(()=>{n=!0}),{priority:"high"}),this.listenTo(e.model,"deleteContent",(()=>{const t=e.model.document.selection;t.isCollapsed||(n?n=!1:ve(e)&&function(e){const t=e.document.selection,i=t.getFirstPosition(),n=t.getLastPosition(),s=i.nodeAfter;if(!s)return!1;if(!s.is("$text"))return!1;if(!s.hasAttribute("linkHref"))return!1;const r=n.textNode||n.nodeBefore;if(s===r)return!0;return(0,o.findAttributeRange)(i,"linkHref",s.getAttribute("linkHref"),e).containsRange(e.createRange(i,n),!0)}(e.model)&&(i=t.getAttributes()))}),{priority:"high"}),this.listenTo(e.model,"insertContent",((t,[o])=>{n=!1,ve(e)&&i&&(e.model.change((e=>{for(const[t,n]of i)e.setAttribute(t,n,o)})),i=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let s=!1,r=!1;this.listenTo(n.document,"delete",((e,t)=>{r="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{s=!1;const e=i.getFirstPosition(),n=i.getAttribute("linkHref");if(!n)return;const r=(0,o.findAttributeRange)(e,"linkHref",n,t);s=r.containsPosition(e)||r.end.isEqual(e)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{r&&(r=!1,s||e.model.enqueueChange((e=>{we(e,_e(t.schema))})))}),{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((e,n)=>{t.change((e=>{const t=e.createRangeIn(n.content);for(const n of t.getItems())if(n.hasAttribute("linkHref")){const t=re(n.getAttribute("linkHref"),i);e.setAttribute("linkHref",t,n)}}))}))}}function we(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}function ve(e){return e.model.change((e=>e.batch)).isTyping}function _e(e){return e.getDefinition("$text").allowAttributes.filter((e=>e.startsWith("link")))}var ye=i(273),Ae=i(995),xe=i(764),Ie={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(xe.Z,Ie);xe.Z.locals;var Ve=i(893),Se={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ve.Z,Se);Ve.Z.locals;class Te extends ye.View{constructor(t,i){super(t),this.focusTracker=new r.FocusTracker,this.keystrokes=new r.KeystrokeHandler,this._focusables=new ye.ViewCollection;const n=t.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),e.icons.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),e.icons.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(i),this.children=this._createFormChildren(i.manualDecorators),this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];i.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),(0,ye.submitHandler)({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new ye.LabeledFieldView(this.locale,ye.createLabeledInputText);return t.label=e("Link URL"),t}_createButton(e,t,i,n){const o=new ye.ButtonView(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const n=new ye.SwitchButtonView(this.locale);n.set({name:i.id,label:i.label,withText:!0}),n.bind("isOn").toMany([i,e],"value",((e,t)=>void 0===t&&void 0===e?!!i.defaultValue:!!e)),n.on("execute",(()=>{i.set("value",!n.isOn)})),t.add(n)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new ye.View;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var Ee=i(952),Le={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ee.Z,Le);Ee.Z.locals;class Ce extends ye.View{constructor(t){super(t),this.focusTracker=new r.FocusTracker,this.keystrokes=new r.KeystrokeHandler,this._focusables=new ye.ViewCollection;const i=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(i("Edit link"),e.icons.pencil,"edit"),this.set("href",void 0),this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const n=new ye.ButtonView(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,i),n}_createPreviewButton(){const e=new ye.ButtonView(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(e=>e&&oe(e))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(e=>e||i("This link has no URL"))),e.bind("isEnabled").to(this,"href",(e=>!!e)),e.template.tag="a",e.template.eventListeners={},e}}const De='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',Me="link-ui";class je extends e.Plugin{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[ye.ContextualBalloon]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(t.ClickObserver),this._balloon=e.plugins.get(ye.ContextualBalloon),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Me,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Me,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new Ce(e.locale),i=e.commands.get("link"),n=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(n),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t.keystrokes.set(ie,((e,t)=>{this._addFormView(),t()})),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),n=new((0,ye.CssTransitionDisablerMixin)(Te))(e.locale,t);return n.urlInputView.fieldView.bind("value").to(t,"value"),n.urlInputView.bind("isEnabled").to(t,"isEnabled"),n.saveButtonView.bind("isEnabled").to(t),this.listenTo(n,"submit",(()=>{const{value:t}=n.urlInputView.fieldView.element,o=re(t,i);e.execute("link",o,n.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(n,"cancel",(()=>{this._closeFormView()})),n.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),n}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",(e=>{const n=new ye.ButtonView(e);return n.isEnabled=!0,n.label=i("Link"),n.icon=De,n.keystroke=ie,n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>this._showUI(!0))),n}))}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(ie,((t,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),(0,ye.clickOutsideHandler)({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=s();const o=()=>{const e=this._getSelectedLinkElement(),t=s();i&&!e||!i&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let n;if(t.markers.has(Me)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(Me)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(i)}else n=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:n}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&(0,Ae.isWidget)(i))return Be(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),n=Be(i.start),o=Be(i.end);return n&&n==o&&e.createRangeIn(n).getTrimmed().isEqual(i)?n:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Me))t.updateMarker(Me,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(Me,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(Me,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Me)&&e.change((e=>{e.removeMarker(Me)}))}}function Be(e){return e.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}const Ne=4,He=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),Oe=2;class Pe extends e.Plugin{static get requires(){return[o.Delete]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new o.TextWatcher(e.model,(e=>{if(!function(e){return e.length>Ne&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=Ue(e.substr(0,e.length-1));return t?{url:t}:void 0}));t.on("matched:data",((t,i)=>{const{batch:n,range:o,url:s}=i;if(!n.isTyping)return;const r=o.end.getShiftedBy(-1),a=r.getShiftedBy(-s.length),c=e.model.createRange(a,r);this._applyAutoLink(s,c)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)}))}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)}))}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=(0,o.getLastTextLine)(e,t),s=Ue(i);if(s){const e=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,e)}}_applyAutoLink(e,t){const i=this.editor.model,n=re(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&ae(n)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange((o=>{o.setAttribute("linkHref",e,t),i.enqueueChange((()=>{n.requestUndoOnBackspace()}))}))}}function Ue(e){const t=He.exec(e);return t?t[Oe]:null}class Fe extends e.Plugin{static get requires(){return[pe,je,Pe]}static get pluginName(){return"Link"}}class Re extends e.Plugin{static get requires(){return["ImageEditing","ImageUtils",pe]}static get pluginName(){return"LinkImageEditing"}init(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,n,o)=>{const s=n.viewItem,r=i.findViewImgElement(s);if(!r)return;const a=r.findAncestor((e=>i.isBlockImageView(e)));if(t&&!a)return;const c={attributes:["href"]};if(!o.consumable.consume(s,c))return;const l=s.getAttribute("href");if(!l)return;let u=n.modelCursor.parent;if(!u.is("element","imageBlock")){const e=o.convertItem(r,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,u=n.modelCursor.nodeBefore}u&&u.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,u)}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const o=n.mapper.toViewElement(i.item),s=n.writer,r=Array.from(o.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(o),c=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?s.setAttribute("href",i.attributeNewValue,r):(s.move(s.createRangeOn(c),s.createPositionAt(o,0)),s.remove(r));else{const e=s.createContainerElement("a",{href:i.attributeNewValue});s.insert(s.createPositionAt(o,0),e),s.move(s.createRangeOn(c),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(ze(i)),e.conversion.for("upcast").add(Ze(e,i))}}function ze(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,i,n)=>{const o=n.mapper.toViewElement(i.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));if(s){for(const[t,i]of(0,r.toMap)(e.attributes))n.writer.setAttribute(t,i,s);e.classes&&n.writer.addClass(e.classes,s);for(const t in e.styles)n.writer.setStyle(t,e.styles[t],s)}}))}}function Ze(e,i){const n=e.plugins.has("ImageInlineEditing"),o=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,s,r)=>{const a=s.viewItem,c=o.findViewImgElement(a);if(!c)return;const l=c.findAncestor((e=>o.isBlockImageView(e)));if(n&&!l)return;const u=new t.Matcher(i._createPattern()).match(a);if(!u)return;if(!r.consumable.consume(a,u.match))return;const d=s.modelCursor.nodeBefore||s.modelCursor.parent;r.writer.setAttribute(i.id,!0,d)}),{priority:"high"})}}class qe extends e.Plugin{static get requires(){return[pe,je,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(i=>{const n=new ye.ButtonView(i),o=e.plugins.get("LinkUI"),s=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:De,keystroke:ie,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addActionsView():o._showUI(!0)})),n}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}var Ke=i(269),Qe={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ke.Z,Qe);Ke.Z.locals;class $e extends e.Plugin{static get requires(){return[Re,qe]}static get pluginName(){return"LinkImage"}}})(),(window.CKEditor5=window.CKEditor5||{}).link=n})();
|
|
5
|
+
*/(()=>{var e={23:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-link_selected span.image-inline{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}",""]);const s=o},952:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{color:var(--ck-color-link-default);cursor:pointer;max-width:var(--ck-input-width);min-width:3em;padding:0 var(--ck-spacing-medium);text-align:center;text-overflow:ellipsis}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{max-width:100%;min-width:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview),[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}}",""]);const s=o},893:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form_layout-vertical .ck-button.ck-button-cancel,.ck.ck-link-form_layout-vertical .ck-button.ck-button-save{margin-top:var(--ck-spacing-medium)}.ck.ck-link-form_layout-vertical{min-width:var(--ck-input-width);padding:0}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical>.ck-button{border-radius:0;margin:0;padding:var(--ck-spacing-standard);width:50%}.ck.ck-link-form_layout-vertical>.ck-button:not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form_layout-vertical>.ck-button,[dir=rtl] .ck.ck-link-form_layout-vertical>.ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin:var(--ck-spacing-standard) var(--ck-spacing-large)}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{padding:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}",""]);const s=o},269:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck.ck-editor__editable a span.image-inline:after,.ck.ck-editor__editable figure.image>a:after{display:block;position:absolute}:root{--ck-link-image-indicator-icon-size:20;--ck-link-image-indicator-icon-is-visible:clamp(0px,100% - 50px,1px)}.ck.ck-editor__editable a span.image-inline:after,.ck.ck-editor__editable figure.image>a:after{background-color:rgba(0,0,0,.4);background-image:url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0iI2ZmZiIgZD0ibTExLjA3NyAxNSAuOTkxLTEuNDE2YS43NS43NSAwIDEgMSAxLjIyOS44NmwtMS4xNDggMS42NGEuNzQ4Ljc0OCAwIDAgMS0uMjE3LjIwNiA1LjI1MSA1LjI1MSAwIDAgMS04LjUwMy01Ljk1NS43NDEuNzQxIDAgMCAxIC4xMi0uMjc0bDEuMTQ3LTEuNjM5YS43NS43NSAwIDEgMSAxLjIyOC44Nkw0LjkzMyAxMC43bC4wMDYuMDAzYTMuNzUgMy43NSAwIDAgMCA2LjEzMiA0LjI5NGwuMDA2LjAwNHptNS40OTQtNS4zMzVhLjc0OC43NDggMCAwIDEtLjEyLjI3NGwtMS4xNDcgMS42MzlhLjc1Ljc1IDAgMSAxLTEuMjI4LS44NmwuODYtMS4yM2EzLjc1IDMuNzUgMCAwIDAtNi4xNDQtNC4zMDFsLS44NiAxLjIyOWEuNzUuNzUgMCAwIDEtMS4yMjktLjg2bDEuMTQ4LTEuNjRhLjc0OC43NDggMCAwIDEgLjIxNy0uMjA2IDUuMjUxIDUuMjUxIDAgMCAxIDguNTAzIDUuOTU1em0tNC41NjMtMi41MzJhLjc1Ljc1IDAgMCAxIC4xODQgMS4wNDVsLTMuMTU1IDQuNTA1YS43NS43NSAwIDEgMS0xLjIyOS0uODZsMy4xNTUtNC41MDZhLjc1Ljc1IDAgMCAxIDEuMDQ1LS4xODR6Ii8+PC9zdmc+");background-position:50%;background-repeat:no-repeat;background-size:14px;border-radius:100%;content:"";height:calc(var(--ck-link-image-indicator-icon-is-visible)*var(--ck-link-image-indicator-icon-size));overflow:hidden;right:min(var(--ck-spacing-medium),6%);top:min(var(--ck-spacing-medium),6%);width:calc(var(--ck-link-image-indicator-icon-is-visible)*var(--ck-link-image-indicator-icon-size))}',""]);const s=o},764:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(609),o=i.n(n)()((function(e){return e[1]}));o.push([e.id,'.ck-vertical-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck-vertical-form .ck-button:focus:after{display:none}@media screen and (max-width:600px){.ck.ck-responsive-form .ck-button:after{bottom:-1px;content:"";position:absolute;right:-1px;top:-1px;width:0;z-index:1}.ck.ck-responsive-form .ck-button:focus:after{display:none}}.ck-vertical-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form{padding:var(--ck-spacing-large)}.ck.ck-responsive-form:focus{outline:none}[dir=ltr] .ck.ck-responsive-form>:not(:first-child),[dir=rtl] .ck.ck-responsive-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-responsive-form{padding:0;width:calc(var(--ck-input-width)*.8)}.ck.ck-responsive-form .ck-labeled-field-view{margin:var(--ck-spacing-large) var(--ck-spacing-large) 0}.ck.ck-responsive-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-responsive-form .ck-labeled-field-view .ck-labeled-field-view__error{white-space:normal}.ck.ck-responsive-form>.ck-button:nth-last-child(2):after{border-right:1px solid var(--ck-color-base-border)}.ck.ck-responsive-form>.ck-button:last-child,.ck.ck-responsive-form>.ck-button:nth-last-child(2){border-radius:0;margin-top:var(--ck-spacing-large);padding:var(--ck-spacing-standard)}.ck.ck-responsive-form>.ck-button:last-child:not(:focus),.ck.ck-responsive-form>.ck-button:nth-last-child(2):not(:focus){border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-responsive-form>.ck-button:last-child,[dir=ltr] .ck.ck-responsive-form>.ck-button:nth-last-child(2),[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2){margin-left:0}[dir=rtl] .ck.ck-responsive-form>.ck-button:last-child:last-of-type,[dir=rtl] .ck.ck-responsive-form>.ck-button:nth-last-child(2):last-of-type{border-right:1px solid var(--ck-color-base-border)}}',""]);const s=o},609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i=e(t);return t[2]?"@media ".concat(t[2]," {").concat(i,"}"):i})).join("")},t.i=function(e,i,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var s=0;s<this.length;s++){var r=this[s][0];null!=r&&(o[r]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);n&&o[c[0]]||(i&&(c[2]?c[2]="".concat(i," and ").concat(c[2]):c[2]=i),t.push(c))}},t}},62:(e,t,i)=>{"use strict";var n,o=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},s=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),r=[];function a(e){for(var t=-1,i=0;i<r.length;i++)if(r[i].identifier===e){t=i;break}return t}function c(e,t){for(var i={},n=[],o=0;o<e.length;o++){var s=e[o],c=t.base?s[0]+t.base:s[0],l=i[c]||0,u="".concat(c," ").concat(l);i[c]=l+1;var d=a(u),k={css:s[1],media:s[2],sourceMap:s[3]};-1!==d?(r[d].references++,r[d].updater(k)):r.push({identifier:u,updater:g(k,t),references:1}),n.push(u)}return n}function l(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var o=i.nc;o&&(n.nonce=o)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var r=s(e.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}return t}var u,d=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function k(e,t,i,n){var o=i?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var s=document.createTextNode(o),r=e.childNodes;r[t]&&e.removeChild(r[t]),r.length?e.insertBefore(s,r[t]):e.appendChild(s)}}function h(e,t,i){var n=i.css,o=i.media,s=i.sourceMap;if(o?e.setAttribute("media",o):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var f=null,m=0;function g(e,t){var i,n,o;if(t.singleton){var s=m++;i=f||(f=l(t)),n=k.bind(null,i,s,!1),o=k.bind(null,i,s,!0)}else i=l(t),n=h.bind(null,i,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(i)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=o());var i=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<i.length;n++){var o=a(i[n]);r[o].references--}for(var s=c(e,t),l=0;l<i.length;l++){var u=a(i[l]);0===r[u].references&&(r[u].updater(),r.splice(u,1))}i=s}}}},945:(e,t,i)=>{e.exports=i(79)("./src/clipboard.js")},704:(e,t,i)=>{e.exports=i(79)("./src/core.js")},492:(e,t,i)=>{e.exports=i(79)("./src/engine.js")},181:(e,t,i)=>{e.exports=i(79)("./src/typing.js")},273:(e,t,i)=>{e.exports=i(79)("./src/ui.js")},209:(e,t,i)=>{e.exports=i(79)("./src/utils.js")},995:(e,t,i)=>{e.exports=i(79)("./src/widget.js")},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={id:n,exports:{}};return e[n](s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var n={};(()=>{"use strict";i.r(n),i.d(n,{AutoLink:()=>Pe,Link:()=>Fe,LinkCommand:()=>le,LinkEditing:()=>pe,LinkImage:()=>$e,LinkImageEditing:()=>Re,LinkImageUI:()=>qe,LinkUI:()=>je,UnlinkCommand:()=>ue});var e=i(704),t=i(492),o=i(181),s=i(945),r=i(209);class a{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((e=>this._definitions.add(e))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!i.schema.isInline(t.item))return;const n=i.writer,o=n.document.selection;for(const e of this._definitions){const s=n.createAttributeElement("a",e.attributes,{priority:5});e.classes&&n.addClass(e.classes,s);for(const t in e.styles)n.setStyle(t,e.styles[t],s);n.setCustomProperty("link",!0,s),e.callback(t.attributeNewValue)?t.item.is("selection")?n.wrap(o.getFirstRange(),s):n.wrap(i.mapper.toViewRange(t.range),s):n.unwrap(i.mapper.toViewRange(t.range),s)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((e,t,{writer:i,mapper:n})=>{const o=n.toViewElement(t.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));for(const e of this._definitions){const n=(0,r.toMap)(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of n)"class"===e?i.addClass(t,s):i.setAttribute(e,t,s);e.classes&&i.addClass(e.classes,s);for(const t in e.styles)i.setStyle(t,e.styles[t],s)}else{for(const[e,t]of n)"class"===e?i.removeClass(t,s):i.removeAttribute(e,s);e.classes&&i.removeClass(e.classes,s);for(const t in e.styles)i.removeStyle(t,s)}}}))}}}const c=function(e,t,i){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(i=i>o?o:i)<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(o);++n<o;)s[n]=e[n+t];return s};const l=function(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:c(e,t,i)};var u=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const d=function(e){return u.test(e)};const k=function(e){return e.split("")};var h="\\ud800-\\udfff",f="["+h+"]",m="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",g="\\ud83c[\\udffb-\\udfff]",b="[^"+h+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",w="[\\ud800-\\udbff][\\udc00-\\udfff]",v="(?:"+m+"|"+g+")"+"?",_="[\\ufe0e\\ufe0f]?",y=_+v+("(?:\\u200d(?:"+[b,p,w].join("|")+")"+_+v+")*"),A="(?:"+[b+m+"?",m,p,w,f].join("|")+")",x=RegExp(g+"(?="+g+")|"+A+y,"g");const I=function(e){return e.match(x)||[]};const V=function(e){return d(e)?I(e):k(e)};const S="object"==typeof global&&global&&global.Object===Object&&global;var T="object"==typeof self&&self&&self.Object===Object&&self;const E=(S||T||Function("return this")()).Symbol;const L=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o};const C=Array.isArray;var D=Object.prototype,M=D.hasOwnProperty,j=D.toString,B=E?E.toStringTag:void 0;const N=function(e){var t=M.call(e,B),i=e[B];try{e[B]=void 0;var n=!0}catch(e){}var o=j.call(e);return n&&(t?e[B]=i:delete e[B]),o};var H=Object.prototype.toString;const O=function(e){return H.call(e)};var P="[object Null]",U="[object Undefined]",F=E?E.toStringTag:void 0;const R=function(e){return null==e?void 0===e?U:P:F&&F in Object(e)?N(e):O(e)};const z=function(e){return null!=e&&"object"==typeof e};var Z="[object Symbol]";const q=function(e){return"symbol"==typeof e||z(e)&&R(e)==Z};var K=1/0,Q=E?E.prototype:void 0,$=Q?Q.toString:void 0;const W=function e(t){if("string"==typeof t)return t;if(C(t))return L(t,e)+"";if(q(t))return $?$.call(t):"";var i=t+"";return"0"==i&&1/t==-K?"-0":i};const Y=function(e){return null==e?"":W(e)};const G=function(e){return function(t){t=Y(t);var i=d(t)?V(t):void 0,n=i?i[0]:t.charAt(0),o=i?l(i,1).join(""):t.slice(1);return n[e]()+o}}("toUpperCase"),J=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,X=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,ee=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,te=/^((\w+:(\/{2,})?)|(\W))/i,ie="Ctrl+K";function ne(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function oe(e){const t=String(e);return function(e){const t=e.replace(J,"");return!!t.match(X)}(t)?t:"#"}function se(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function re(e,t){const i=(n=e,ee.test(n)?"mailto:":t);var n;const o=!!i&&!ae(e);return e&&o?i+e:e}function ae(e){return te.test(e)}function ce(e){window.open(e,"_blank","noopener")}class le extends e.Command{constructor(){super(...arguments),this.manualDecorators=new r.Collection,this.automaticDecorators=new a}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||(0,r.first)(t.getSelectedBlocks());se(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,n=i.document.selection,s=[],a=[];for(const e in t)t[e]?s.push(e):a.push(e);i.change((t=>{if(n.isCollapsed){const c=n.getFirstPosition();if(n.hasAttribute("linkHref")){const r=(0,o.findAttributeRange)(c,"linkHref",n.getAttribute("linkHref"),i);t.setAttribute("linkHref",e,r),s.forEach((e=>{t.setAttribute(e,!0,r)})),a.forEach((e=>{t.removeAttribute(e,r)})),t.setSelection(t.createPositionAfter(r.end.nodeBefore))}else if(""!==e){const o=(0,r.toMap)(n.getAttributes());o.set("linkHref",e),s.forEach((e=>{o.set(e,!0)}));const{end:a}=i.insertContent(t.createText(e,o),c);t.setSelection(a)}["linkHref",...s,...a].forEach((e=>{t.removeSelectionAttribute(e)}))}else{const o=i.schema.getValidRanges(n.getRanges(),"linkHref"),r=[];for(const e of n.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&r.push(t.createRangeOn(e));const c=r.slice();for(const e of o)this._isRangeToUpdate(e,r)&&c.push(e);for(const i of c)t.setAttribute("linkHref",e,i),s.forEach((e=>{t.setAttribute(e,!0,i)})),a.forEach((e=>{t.removeAttribute(e,i)}))}}))}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return se(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}}class ue extends e.Command{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();se(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change((e=>{const s=i.isCollapsed?[(0,o.findAttributeRange)(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),n)for(const i of n.manualDecorators)e.removeAttribute(i.id,t)}))}}class de extends((0,r.ObservableMixin)()){constructor({id:e,label:t,attributes:i,classes:n,styles:o,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=i,this.classes=n,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var ke=i(62),he=i.n(ke),fe=i(23),me={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(fe.Z,me);fe.Z.locals;const ge="automatic",be=/^(https?:)?\/\//;class pe extends e.Plugin{static get pluginName(){return"LinkEditing"}static get requires(){return[o.TwoStepCaretMovement,o.Input,s.ClipboardPipeline]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:ne}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>ne(oe(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new le(e)),e.commands.add("unlink",new ue(e));const t=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach((e=>("label"in e&&i[e.label]&&(e.label=i[e.label]),e))),t}(e.t,function(e){const t=[];if(e)for(const[i,n]of Object.entries(e)){const e=Object.assign({},n,{id:`link${G(i)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter((e=>e.mode===ge))),this._enableManualDecorators(t.filter((e=>"manual"===e.mode)));e.plugins.get(o.TwoStepCaretMovement).registerAttribute("linkHref"),(0,o.inlineHighlight)(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:ge,callback:e=>!!e&&be.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach((e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const n=new de(e);i.add(n),t.conversion.for("downcast").attributeToElement({model:n.id,view:(e,{writer:t,schema:i},{item:o})=>{if((o.is("selection")||i.isInline(o))&&e){const e=t.createAttributeElement("a",n.attributes,{priority:5});n.classes&&t.addClass(n.classes,e);for(const i in n.styles)t.setStyle(i,n.styles[i],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}})}))}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((e,t)=>{if(!(r.env.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let i=t.domTarget;if("a"!=i.tagName.toLowerCase()&&(i=i.closest("a")),!i)return;const n=i.getAttribute("href");n&&(e.stop(),t.preventDefault(),ce(n))}),{context:"$capture"}),this.listenTo(t,"keydown",((t,i)=>{const n=e.commands.get("link").value;!!n&&i.keyCode===r.keyCodes.enter&&i.altKey&&(t.stop(),ce(n))}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",(()=>{const i=t.anchor.nodeBefore,n=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&i&&i.hasAttribute("linkHref")&&(n&&n.hasAttribute("linkHref")||e.change((t=>{we(t,_e(e.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,i=e.model;e.editing.view.addObserver(t.MouseObserver);let n=!1;this.listenTo(e.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(e.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const e=i.document.selection;if(!e.isCollapsed)return;if(!e.hasAttribute("linkHref"))return;const t=e.getFirstPosition(),s=(0,o.findAttributeRange)(t,"linkHref",e.getAttribute("linkHref"),i);(t.isTouching(s.start)||t.isTouching(s.end))&&i.change((e=>{we(e,_e(i.schema))}))}))}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let i=null,n=!1;this.listenTo(t.document,"delete",(()=>{n=!0}),{priority:"high"}),this.listenTo(e.model,"deleteContent",(()=>{const t=e.model.document.selection;t.isCollapsed||(n?n=!1:ve(e)&&function(e){const t=e.document.selection,i=t.getFirstPosition(),n=t.getLastPosition(),s=i.nodeAfter;if(!s)return!1;if(!s.is("$text"))return!1;if(!s.hasAttribute("linkHref"))return!1;const r=n.textNode||n.nodeBefore;if(s===r)return!0;return(0,o.findAttributeRange)(i,"linkHref",s.getAttribute("linkHref"),e).containsRange(e.createRange(i,n),!0)}(e.model)&&(i=t.getAttributes()))}),{priority:"high"}),this.listenTo(e.model,"insertContent",((t,[o])=>{n=!1,ve(e)&&i&&(e.model.change((e=>{for(const[t,n]of i)e.setAttribute(t,n,o)})),i=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let s=!1,r=!1;this.listenTo(n.document,"delete",((e,t)=>{r="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{s=!1;const e=i.getFirstPosition(),n=i.getAttribute("linkHref");if(!n)return;const r=(0,o.findAttributeRange)(e,"linkHref",n,t);s=r.containsPosition(e)||r.end.isEqual(e)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{r&&(r=!1,s||e.model.enqueueChange((e=>{we(e,_e(t.schema))})))}),{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((e,n)=>{t.change((e=>{const t=e.createRangeIn(n.content);for(const n of t.getItems())if(n.hasAttribute("linkHref")){const t=re(n.getAttribute("linkHref"),i);e.setAttribute("linkHref",t,n)}}))}))}}function we(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}function ve(e){return e.model.change((e=>e.batch)).isTyping}function _e(e){return e.getDefinition("$text").allowAttributes.filter((e=>e.startsWith("link")))}var ye=i(273),Ae=i(995),xe=i(764),Ie={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(xe.Z,Ie);xe.Z.locals;var Ve=i(893),Se={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ve.Z,Se);Ve.Z.locals;class Te extends ye.View{constructor(t,i){super(t),this.focusTracker=new r.FocusTracker,this.keystrokes=new r.KeystrokeHandler,this._focusables=new ye.ViewCollection;const n=t.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),e.icons.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),e.icons.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(i),this.children=this._createFormChildren(i.manualDecorators),this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];i.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),(0,ye.submitHandler)({view:this});[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new ye.LabeledFieldView(this.locale,ye.createLabeledInputText);return t.label=e("Link URL"),t}_createButton(e,t,i,n){const o=new ye.ButtonView(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const n=new ye.SwitchButtonView(this.locale);n.set({name:i.id,label:i.label,withText:!0}),n.bind("isOn").toMany([i,e],"value",((e,t)=>void 0===t&&void 0===e?!!i.defaultValue:!!e)),n.on("execute",(()=>{i.set("value",!n.isOn)})),t.add(n)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new ye.View;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var Ee=i(952),Le={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ee.Z,Le);Ee.Z.locals;class Ce extends ye.View{constructor(t){super(t),this.focusTracker=new r.FocusTracker,this.keystrokes=new r.KeystrokeHandler,this._focusables=new ye.ViewCollection;const i=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(i("Edit link"),e.icons.pencil,"edit"),this.set("href",void 0),this._focusCycler=new ye.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render();[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const n=new ye.ButtonView(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,i),n}_createPreviewButton(){const e=new ye.ButtonView(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(e=>e&&oe(e))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(e=>e||i("This link has no URL"))),e.bind("isEnabled").to(this,"href",(e=>!!e)),e.template.tag="a",e.template.eventListeners={},e}}const De='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',Me="link-ui";class je extends e.Plugin{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[ye.ContextualBalloon]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(t.ClickObserver),this._balloon=e.plugins.get(ye.ContextualBalloon),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Me,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Me,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new Ce(e.locale),i=e.commands.get("link"),n=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(n),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t.keystrokes.set(ie,((e,t)=>{this._addFormView(),t()})),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),n=new((0,ye.CssTransitionDisablerMixin)(Te))(e.locale,t);return n.urlInputView.fieldView.bind("value").to(t,"value"),n.urlInputView.bind("isEnabled").to(t,"isEnabled"),n.saveButtonView.bind("isEnabled").to(t),this.listenTo(n,"submit",(()=>{const{value:t}=n.urlInputView.fieldView.element,o=re(t,i);e.execute("link",o,n.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(n,"cancel",(()=>{this._closeFormView()})),n.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),n}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",(e=>{const n=new ye.ButtonView(e);return n.isEnabled=!0,n.label=i("Link"),n.icon=De,n.keystroke=ie,n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>this._showUI(!0))),n}))}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(ie,((t,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),(0,ye.clickOutsideHandler)({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=e.value||""}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=s();const o=()=>{const e=this._getSelectedLinkElement(),t=s();i&&!e||!i&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let n;if(t.markers.has(Me)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(Me)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(i)}else n=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:n}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&(0,Ae.isWidget)(i))return Be(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),n=Be(i.start),o=Be(i.end);return n&&n==o&&e.createRangeIn(n).getTrimmed().isEqual(i)?n:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Me))t.updateMarker(Me,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(Me,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(Me,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Me)&&e.change((e=>{e.removeMarker(Me)}))}}function Be(e){return e.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}const Ne=4,He=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),Oe=2;class Pe extends e.Plugin{static get requires(){return[o.Delete]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const e=this.editor,t=new o.TextWatcher(e.model,(e=>{if(!function(e){return e.length>Ne&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=Ue(e.substr(0,e.length-1));return t?{url:t}:void 0}));t.on("matched:data",((t,i)=>{const{batch:n,range:o,url:s}=i;if(!n.isTyping)return;const r=o.end.getShiftedBy(-1),a=r.getShiftedBy(-s.length),c=e.model.createRange(a,r);this._applyAutoLink(s,c)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)}))}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)}))}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=(0,o.getLastTextLine)(e,t),s=Ue(i);if(s){const e=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,e)}}_applyAutoLink(e,t){const i=this.editor.model,n=re(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&ae(n)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange((o=>{o.setAttribute("linkHref",e,t),i.enqueueChange((()=>{n.requestUndoOnBackspace()}))}))}}function Ue(e){const t=He.exec(e);return t?t[Oe]:null}class Fe extends e.Plugin{static get requires(){return[pe,je,Pe]}static get pluginName(){return"Link"}}class Re extends e.Plugin{static get requires(){return["ImageEditing","ImageUtils",pe]}static get pluginName(){return"LinkImageEditing"}init(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,n,o)=>{const s=n.viewItem,r=i.findViewImgElement(s);if(!r)return;const a=r.findAncestor((e=>i.isBlockImageView(e)));if(t&&!a)return;const c={attributes:["href"]};if(!o.consumable.consume(s,c))return;const l=s.getAttribute("href");if(!l)return;let u=n.modelCursor.parent;if(!u.is("element","imageBlock")){const e=o.convertItem(r,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,u=n.modelCursor.nodeBefore}u&&u.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,u)}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const o=n.mapper.toViewElement(i.item),s=n.writer,r=Array.from(o.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(o),c=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?s.setAttribute("href",i.attributeNewValue,r):(s.move(s.createRangeOn(c),s.createPositionAt(o,0)),s.remove(r));else{const e=s.createContainerElement("a",{href:i.attributeNewValue});s.insert(s.createPositionAt(o,0),e),s.move(s.createRangeOn(c),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(ze(i)),e.conversion.for("upcast").add(Ze(e,i))}}function ze(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,i,n)=>{const o=n.mapper.toViewElement(i.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));if(s){for(const[t,i]of(0,r.toMap)(e.attributes))n.writer.setAttribute(t,i,s);e.classes&&n.writer.addClass(e.classes,s);for(const t in e.styles)n.writer.setStyle(t,e.styles[t],s)}}))}}function Ze(e,i){const n=e.plugins.has("ImageInlineEditing"),o=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,s,r)=>{const a=s.viewItem,c=o.findViewImgElement(a);if(!c)return;const l=c.findAncestor((e=>o.isBlockImageView(e)));if(n&&!l)return;const u=new t.Matcher(i._createPattern()).match(a);if(!u)return;if(!r.consumable.consume(a,u.match))return;const d=s.modelCursor.nodeBefore||s.modelCursor.parent;r.writer.setAttribute(i.id,!0,d)}),{priority:"high"})}}class qe extends e.Plugin{static get requires(){return[pe,je,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(i=>{const n=new ye.ButtonView(i),o=e.plugins.get("LinkUI"),s=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:De,keystroke:ie,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addActionsView():o._showUI(!0)})),n}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}var Ke=i(269),Qe={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};he()(Ke.Z,Qe);Ke.Z.locals;class $e extends e.Plugin{static get requires(){return[Re,qe]}static get pluginName(){return"LinkImage"}}})(),(window.CKEditor5=window.CKEditor5||{}).link=n})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-link",
|
|
3
|
-
"version": "37.0.0-alpha.
|
|
3
|
+
"version": "37.0.0-alpha.2",
|
|
4
4
|
"description": "Link feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,30 +12,30 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.
|
|
16
|
-
"ckeditor5": "^37.0.0-alpha.
|
|
15
|
+
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.2",
|
|
16
|
+
"ckeditor5": "^37.0.0-alpha.2",
|
|
17
17
|
"lodash-es": "^4.17.15"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.
|
|
21
|
-
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.
|
|
22
|
-
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.
|
|
23
|
-
"@ckeditor/ckeditor5-cloud-services": "^37.0.0-alpha.
|
|
24
|
-
"@ckeditor/ckeditor5-code-block": "^37.0.0-alpha.
|
|
25
|
-
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.
|
|
26
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
|
27
|
-
"@ckeditor/ckeditor5-easy-image": "^37.0.0-alpha.
|
|
28
|
-
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.
|
|
29
|
-
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.
|
|
30
|
-
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.
|
|
31
|
-
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.
|
|
32
|
-
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.
|
|
33
|
-
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.
|
|
34
|
-
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.
|
|
35
|
-
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.
|
|
36
|
-
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.
|
|
37
|
-
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.
|
|
38
|
-
"@ckeditor/ckeditor5-widget": "^37.0.0-alpha.
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.2",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.2",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.2",
|
|
23
|
+
"@ckeditor/ckeditor5-cloud-services": "^37.0.0-alpha.2",
|
|
24
|
+
"@ckeditor/ckeditor5-code-block": "^37.0.0-alpha.2",
|
|
25
|
+
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.2",
|
|
26
|
+
"@ckeditor/ckeditor5-dev-utils": "^35.0.0",
|
|
27
|
+
"@ckeditor/ckeditor5-easy-image": "^37.0.0-alpha.2",
|
|
28
|
+
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.2",
|
|
29
|
+
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.2",
|
|
30
|
+
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.2",
|
|
31
|
+
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.2",
|
|
32
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.2",
|
|
33
|
+
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.2",
|
|
34
|
+
"@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.2",
|
|
35
|
+
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.2",
|
|
36
|
+
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.2",
|
|
37
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.2",
|
|
38
|
+
"@ckeditor/ckeditor5-widget": "^37.0.0-alpha.2",
|
|
39
39
|
"typescript": "^4.8.4",
|
|
40
40
|
"webpack": "^5.58.1",
|
|
41
41
|
"webpack-cli": "^4.9.0"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
],
|
|
65
65
|
"scripts": {
|
|
66
66
|
"dll:build": "webpack",
|
|
67
|
-
"build": "tsc -p ./tsconfig.
|
|
67
|
+
"build": "tsc -p ./tsconfig.json",
|
|
68
68
|
"postversion": "npm run build"
|
|
69
69
|
},
|
|
70
70
|
"types": "src/index.d.ts"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import type { LinkConfig, AutoLink, Link, LinkEditing, LinkImage, LinkImageEditing, LinkImageUI, LinkUI, LinkCommand, UnlinkCommand } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration of the {@link module:link/link~Link} feature.
|
|
10
|
+
*
|
|
11
|
+
* Read more in {@link module:link/linkconfig~LinkConfig}.
|
|
12
|
+
*/
|
|
13
|
+
link?: LinkConfig;
|
|
14
|
+
}
|
|
15
|
+
interface PluginsMap {
|
|
16
|
+
[AutoLink.pluginName]: AutoLink;
|
|
17
|
+
[Link.pluginName]: Link;
|
|
18
|
+
[LinkEditing.pluginName]: LinkEditing;
|
|
19
|
+
[LinkImage.pluginName]: LinkImage;
|
|
20
|
+
[LinkImageEditing.pluginName]: LinkImageEditing;
|
|
21
|
+
[LinkImageUI.pluginName]: LinkImageUI;
|
|
22
|
+
[LinkUI.pluginName]: LinkUI;
|
|
23
|
+
}
|
|
24
|
+
interface CommandsMap {
|
|
25
|
+
link: LinkCommand;
|
|
26
|
+
}
|
|
27
|
+
interface CommandsMap {
|
|
28
|
+
unlink: UnlinkCommand;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/autolink.d.ts
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -12,3 +12,7 @@ export { default as LinkImage } from './linkimage';
|
|
|
12
12
|
export { default as LinkImageEditing } from './linkimageediting';
|
|
13
13
|
export { default as LinkImageUI } from './linkimageui';
|
|
14
14
|
export { default as AutoLink } from './autolink';
|
|
15
|
+
export { LinkConfig } from './linkconfig';
|
|
16
|
+
export { default as LinkCommand } from './linkcommand';
|
|
17
|
+
export { default as UnlinkCommand } from './unlinkcommand';
|
|
18
|
+
import './augmentation';
|
package/src/index.js
CHANGED
|
@@ -12,3 +12,6 @@ export { default as LinkImage } from './linkimage';
|
|
|
12
12
|
export { default as LinkImageEditing } from './linkimageediting';
|
|
13
13
|
export { default as LinkImageUI } from './linkimageui';
|
|
14
14
|
export { default as AutoLink } from './autolink';
|
|
15
|
+
export { default as LinkCommand } from './linkcommand';
|
|
16
|
+
export { default as UnlinkCommand } from './unlinkcommand';
|
|
17
|
+
import './augmentation';
|
package/src/link.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @module link/link
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
|
|
9
|
-
import './linkconfig';
|
|
10
9
|
/**
|
|
11
10
|
* The link plugin.
|
|
12
11
|
*
|
|
@@ -23,8 +22,3 @@ export default class Link extends Plugin {
|
|
|
23
22
|
*/
|
|
24
23
|
static get pluginName(): 'Link';
|
|
25
24
|
}
|
|
26
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
27
|
-
interface PluginsMap {
|
|
28
|
-
[Link.pluginName]: Link;
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/link.js
CHANGED
package/src/linkcommand.d.ts
CHANGED
|
@@ -21,14 +21,14 @@ export default class LinkCommand extends Command {
|
|
|
21
21
|
*/
|
|
22
22
|
value: string | undefined;
|
|
23
23
|
/**
|
|
24
|
-
* A collection of {@link module:link/utils~ManualDecorator manual decorators}
|
|
25
|
-
* corresponding to the {@link module:link/
|
|
24
|
+
* A collection of {@link module:link/utils/manualdecorator~ManualDecorator manual decorators}
|
|
25
|
+
* corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
|
|
26
26
|
*
|
|
27
27
|
* You can consider it a model with states of manual decorators added to the currently selected link.
|
|
28
28
|
*/
|
|
29
29
|
readonly manualDecorators: Collection<ManualDecorator>;
|
|
30
30
|
/**
|
|
31
|
-
* An instance of the helper that ties together all {@link module:link/
|
|
31
|
+
* An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
32
32
|
* that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.
|
|
33
33
|
*/
|
|
34
34
|
readonly automaticDecorators: AutomaticDecorators;
|
|
@@ -57,13 +57,14 @@ export default class LinkCommand extends Command {
|
|
|
57
57
|
*
|
|
58
58
|
* There is an optional argument to this command that applies or removes model
|
|
59
59
|
* {@glink framework/guides/architecture/editing-engine#text-attributes text attributes} brought by
|
|
60
|
-
* {@link module:link/utils~ManualDecorator manual link decorators}.
|
|
60
|
+
* {@link module:link/utils/manualdecorator~ManualDecorator manual link decorators}.
|
|
61
61
|
*
|
|
62
|
-
* Text attribute names in the model correspond to the entries in the {@link module:link/
|
|
62
|
+
* Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
|
|
63
|
+
* configuration}.
|
|
63
64
|
* For every decorator configured, a model text attribute exists with the "link" prefix. For example, a `'linkMyDecorator'` attribute
|
|
64
65
|
* corresponds to `'myDecorator'` in the configuration.
|
|
65
66
|
*
|
|
66
|
-
* To learn more about link decorators, check out the {@link module:link/
|
|
67
|
+
* To learn more about link decorators, check out the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`}
|
|
67
68
|
* documentation.
|
|
68
69
|
*
|
|
69
70
|
* Here is how to manage decorator attributes with the link command:
|
|
@@ -120,8 +121,3 @@ export default class LinkCommand extends Command {
|
|
|
120
121
|
*/
|
|
121
122
|
private _isRangeToUpdate;
|
|
122
123
|
}
|
|
123
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
124
|
-
interface CommandsMap {
|
|
125
|
-
link: LinkCommand;
|
|
126
|
-
}
|
|
127
|
-
}
|
package/src/linkcommand.js
CHANGED
|
@@ -17,14 +17,14 @@ export default class LinkCommand extends Command {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
19
|
/**
|
|
20
|
-
* A collection of {@link module:link/utils~ManualDecorator manual decorators}
|
|
21
|
-
* corresponding to the {@link module:link/
|
|
20
|
+
* A collection of {@link module:link/utils/manualdecorator~ManualDecorator manual decorators}
|
|
21
|
+
* corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
|
|
22
22
|
*
|
|
23
23
|
* You can consider it a model with states of manual decorators added to the currently selected link.
|
|
24
24
|
*/
|
|
25
25
|
this.manualDecorators = new Collection();
|
|
26
26
|
/**
|
|
27
|
-
* An instance of the helper that ties together all {@link module:link/
|
|
27
|
+
* An instance of the helper that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition}
|
|
28
28
|
* that are used by the {@glink features/link link} and the {@glink features/images/images-linking linking images} features.
|
|
29
29
|
*/
|
|
30
30
|
this.automaticDecorators = new AutomaticDecorators();
|
|
@@ -75,13 +75,14 @@ export default class LinkCommand extends Command {
|
|
|
75
75
|
*
|
|
76
76
|
* There is an optional argument to this command that applies or removes model
|
|
77
77
|
* {@glink framework/guides/architecture/editing-engine#text-attributes text attributes} brought by
|
|
78
|
-
* {@link module:link/utils~ManualDecorator manual link decorators}.
|
|
78
|
+
* {@link module:link/utils/manualdecorator~ManualDecorator manual link decorators}.
|
|
79
79
|
*
|
|
80
|
-
* Text attribute names in the model correspond to the entries in the {@link module:link/
|
|
80
|
+
* Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
|
|
81
|
+
* configuration}.
|
|
81
82
|
* For every decorator configured, a model text attribute exists with the "link" prefix. For example, a `'linkMyDecorator'` attribute
|
|
82
83
|
* corresponds to `'myDecorator'` in the configuration.
|
|
83
84
|
*
|
|
84
|
-
* To learn more about link decorators, check out the {@link module:link/
|
|
85
|
+
* To learn more about link decorators, check out the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`}
|
|
85
86
|
* documentation.
|
|
86
87
|
*
|
|
87
88
|
* Here is how to manage decorator attributes with the link command:
|
package/src/linkconfig.d.ts
CHANGED
|
@@ -249,13 +249,3 @@ export interface LinkDecoratorManualDefinition {
|
|
|
249
249
|
*/
|
|
250
250
|
defaultValue?: boolean;
|
|
251
251
|
}
|
|
252
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
253
|
-
/**
|
|
254
|
-
* The configuration of the {@link module:link/link~Link} feature.
|
|
255
|
-
*
|
|
256
|
-
* Read more in {@link module:link/linkconfig~LinkConfig}.
|
|
257
|
-
*/
|
|
258
|
-
interface EditorConfig {
|
|
259
|
-
link?: LinkConfig;
|
|
260
|
-
}
|
|
261
|
-
}
|
package/src/linkediting.d.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @module link/linkediting
|
|
7
7
|
*/
|
|
8
8
|
import { Plugin, type PluginDependencies, type Editor } from 'ckeditor5/src/core';
|
|
9
|
-
import './linkconfig';
|
|
10
9
|
import '../theme/link.css';
|
|
11
10
|
/**
|
|
12
11
|
* The link engine feature.
|
|
@@ -32,18 +31,18 @@ export default class LinkEditing extends Plugin {
|
|
|
32
31
|
*/
|
|
33
32
|
init(): void;
|
|
34
33
|
/**
|
|
35
|
-
* Processes an array of configured {@link module:link/
|
|
34
|
+
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}
|
|
36
35
|
* and registers a {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}
|
|
37
36
|
* for each one of them. Downcast dispatchers are obtained using the
|
|
38
|
-
* {@link module:link/utils~AutomaticDecorators#getDispatcher} method.
|
|
37
|
+
* {@link module:link/utils/automaticdecorators~AutomaticDecorators#getDispatcher} method.
|
|
39
38
|
*
|
|
40
39
|
* **Note**: This method also activates the automatic external link decorator if enabled with
|
|
41
|
-
* {@link module:link/
|
|
40
|
+
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.
|
|
42
41
|
*/
|
|
43
42
|
private _enableAutomaticDecorators;
|
|
44
43
|
/**
|
|
45
|
-
* Processes an array of configured {@link module:link/
|
|
46
|
-
* transforms them into {@link module:link/utils~ManualDecorator} instances and stores them in the
|
|
44
|
+
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},
|
|
45
|
+
* transforms them into {@link module:link/utils/manualdecorator~ManualDecorator} instances and stores them in the
|
|
47
46
|
* {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).
|
|
48
47
|
*
|
|
49
48
|
* Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}
|
|
@@ -103,8 +102,3 @@ export default class LinkEditing extends Plugin {
|
|
|
103
102
|
*/
|
|
104
103
|
private _enableClipboardIntegration;
|
|
105
104
|
}
|
|
106
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
107
|
-
interface PluginsMap {
|
|
108
|
-
[LinkEditing.pluginName]: LinkEditing;
|
|
109
|
-
}
|
|
110
|
-
}
|
package/src/linkediting.js
CHANGED
|
@@ -14,7 +14,6 @@ import LinkCommand from './linkcommand';
|
|
|
14
14
|
import UnlinkCommand from './unlinkcommand';
|
|
15
15
|
import ManualDecorator from './utils/manualdecorator';
|
|
16
16
|
import { createLinkElement, ensureSafeUrl, getLocalizedDecorators, normalizeDecorators, openLink, addLinkProtocolIfApplicable } from './utils';
|
|
17
|
-
import './linkconfig';
|
|
18
17
|
import '../theme/link.css';
|
|
19
18
|
const HIGHLIGHT_CLASS = 'ck-link_selected';
|
|
20
19
|
const DECORATOR_AUTOMATIC = 'automatic';
|
|
@@ -102,13 +101,13 @@ export default class LinkEditing extends Plugin {
|
|
|
102
101
|
this._enableClipboardIntegration();
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
|
-
* Processes an array of configured {@link module:link/
|
|
104
|
+
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}
|
|
106
105
|
* and registers a {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast dispatcher}
|
|
107
106
|
* for each one of them. Downcast dispatchers are obtained using the
|
|
108
|
-
* {@link module:link/utils~AutomaticDecorators#getDispatcher} method.
|
|
107
|
+
* {@link module:link/utils/automaticdecorators~AutomaticDecorators#getDispatcher} method.
|
|
109
108
|
*
|
|
110
109
|
* **Note**: This method also activates the automatic external link decorator if enabled with
|
|
111
|
-
* {@link module:link/
|
|
110
|
+
* {@link module:link/linkconfig~LinkConfig#addTargetToExternalLinks `config.link.addTargetToExternalLinks`}.
|
|
112
111
|
*/
|
|
113
112
|
_enableAutomaticDecorators(automaticDecoratorDefinitions) {
|
|
114
113
|
const editor = this.editor;
|
|
@@ -134,8 +133,8 @@ export default class LinkEditing extends Plugin {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
/**
|
|
137
|
-
* Processes an array of configured {@link module:link/
|
|
138
|
-
* transforms them into {@link module:link/utils~ManualDecorator} instances and stores them in the
|
|
136
|
+
* Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},
|
|
137
|
+
* transforms them into {@link module:link/utils/manualdecorator~ManualDecorator} instances and stores them in the
|
|
139
138
|
* {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).
|
|
140
139
|
*
|
|
141
140
|
* Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}
|
package/src/linkimage.d.ts
CHANGED
|
@@ -26,18 +26,13 @@ export default class LinkImageEditing extends Plugin {
|
|
|
26
26
|
*/
|
|
27
27
|
init(): void;
|
|
28
28
|
/**
|
|
29
|
-
* Processes {@link module:link/
|
|
29
|
+
* Processes {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators} definitions and
|
|
30
30
|
* attaches proper converters that will work when linking an image.`
|
|
31
31
|
*/
|
|
32
32
|
private _enableAutomaticDecorators;
|
|
33
33
|
/**
|
|
34
|
-
* Processes transformed {@link module:link/utils~ManualDecorator} instances and attaches proper converters
|
|
34
|
+
* Processes transformed {@link module:link/utils/manualdecorator~ManualDecorator} instances and attaches proper converters
|
|
35
35
|
* that will work when linking an image.
|
|
36
36
|
*/
|
|
37
37
|
private _enableManualDecorators;
|
|
38
38
|
}
|
|
39
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
40
|
-
interface PluginsMap {
|
|
41
|
-
[LinkImageEditing.pluginName]: LinkImageEditing;
|
|
42
|
-
}
|
|
43
|
-
}
|
package/src/linkimageediting.js
CHANGED
|
@@ -44,7 +44,7 @@ export default class LinkImageEditing extends Plugin {
|
|
|
44
44
|
this._enableManualDecorators();
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Processes {@link module:link/
|
|
47
|
+
* Processes {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators} definitions and
|
|
48
48
|
* attaches proper converters that will work when linking an image.`
|
|
49
49
|
*/
|
|
50
50
|
_enableAutomaticDecorators() {
|
|
@@ -56,7 +56,7 @@ export default class LinkImageEditing extends Plugin {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Processes transformed {@link module:link/utils~ManualDecorator} instances and attaches proper converters
|
|
59
|
+
* Processes transformed {@link module:link/utils/manualdecorator~ManualDecorator} instances and attaches proper converters
|
|
60
60
|
* that will work when linking an image.
|
|
61
61
|
*/
|
|
62
62
|
_enableManualDecorators() {
|
package/src/linkimageui.d.ts
CHANGED
package/src/linkui.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export default class LinkUI extends Plugin {
|
|
|
85
85
|
* Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is
|
|
86
86
|
* decided upon the link command value (which has a value if the document selection is in the link).
|
|
87
87
|
*
|
|
88
|
-
* Additionally, if any {@link module:link/
|
|
88
|
+
* Additionally, if any {@link module:link/linkconfig~LinkConfig#decorators} are defined in the editor configuration, the state of
|
|
89
89
|
* switch buttons responsible for manual decorator handling is restored.
|
|
90
90
|
*/
|
|
91
91
|
private _closeFormView;
|
|
@@ -106,7 +106,7 @@ export default class LinkUI extends Plugin {
|
|
|
106
106
|
*/
|
|
107
107
|
private _hideUI;
|
|
108
108
|
/**
|
|
109
|
-
* Makes the UI react to the {@link module:
|
|
109
|
+
* Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
|
|
110
110
|
* reposition itself when the editor UI should be refreshed.
|
|
111
111
|
*
|
|
112
112
|
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
|
@@ -163,8 +163,3 @@ export default class LinkUI extends Plugin {
|
|
|
163
163
|
*/
|
|
164
164
|
private _hideFakeVisualSelection;
|
|
165
165
|
}
|
|
166
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
167
|
-
interface PluginsMap {
|
|
168
|
-
[LinkUI.pluginName]: LinkUI;
|
|
169
|
-
}
|
|
170
|
-
}
|
package/src/linkui.js
CHANGED
|
@@ -286,7 +286,7 @@ export default class LinkUI extends Plugin {
|
|
|
286
286
|
* Closes the form view. Decides whether the balloon should be hidden completely or if the action view should be shown. This is
|
|
287
287
|
* decided upon the link command value (which has a value if the document selection is in the link).
|
|
288
288
|
*
|
|
289
|
-
* Additionally, if any {@link module:link/
|
|
289
|
+
* Additionally, if any {@link module:link/linkconfig~LinkConfig#decorators} are defined in the editor configuration, the state of
|
|
290
290
|
* switch buttons responsible for manual decorator handling is restored.
|
|
291
291
|
*/
|
|
292
292
|
_closeFormView() {
|
|
@@ -377,7 +377,7 @@ export default class LinkUI extends Plugin {
|
|
|
377
377
|
this._hideFakeVisualSelection();
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
380
|
-
* Makes the UI react to the {@link module:
|
|
380
|
+
* Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
|
|
381
381
|
* reposition itself when the editor UI should be refreshed.
|
|
382
382
|
*
|
|
383
383
|
* See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
|
|
@@ -82,18 +82,18 @@ export default class LinkActionsView extends View {
|
|
|
82
82
|
private _createPreviewButton;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Fired when the {@link #editButtonView} is clicked.
|
|
85
|
+
* Fired when the {@link ~LinkActionsView#editButtonView} is clicked.
|
|
86
86
|
*
|
|
87
|
-
* @eventName edit
|
|
87
|
+
* @eventName ~LinkActionsView#edit
|
|
88
88
|
*/
|
|
89
89
|
export type EditEvent = {
|
|
90
90
|
name: 'edit';
|
|
91
91
|
args: [];
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
|
-
* Fired when the {@link #unlinkButtonView} is clicked.
|
|
94
|
+
* Fired when the {@link ~LinkActionsView#unlinkButtonView} is clicked.
|
|
95
95
|
*
|
|
96
|
-
* @eventName unlink
|
|
96
|
+
* @eventName ~LinkActionsView#unlink
|
|
97
97
|
*/
|
|
98
98
|
export type UnlinkEvent = {
|
|
99
99
|
name: 'unlink';
|
package/src/ui/linkformview.d.ts
CHANGED
|
@@ -122,18 +122,18 @@ export default class LinkFormView extends View {
|
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* Fired when the form view is submitted (when one of the children triggered the submit event),
|
|
125
|
-
* for example with a click on {@link #saveButtonView}.
|
|
125
|
+
* for example with a click on {@link ~LinkFormView#saveButtonView}.
|
|
126
126
|
*
|
|
127
|
-
* @eventName submit
|
|
127
|
+
* @eventName ~LinkFormView#submit
|
|
128
128
|
*/
|
|
129
129
|
export type SubmitEvent = {
|
|
130
130
|
name: 'submit';
|
|
131
131
|
args: [];
|
|
132
132
|
};
|
|
133
133
|
/**
|
|
134
|
-
* Fired when the form view is canceled, for example with a click on {@link #cancelButtonView}.
|
|
134
|
+
* Fired when the form view is canceled, for example with a click on {@link ~LinkFormView#cancelButtonView}.
|
|
135
135
|
*
|
|
136
|
-
* @eventName cancel
|
|
136
|
+
* @eventName ~LinkFormView#cancel
|
|
137
137
|
*/
|
|
138
138
|
export type CancelEvent = {
|
|
139
139
|
name: 'cancel';
|
package/src/unlinkcommand.d.ts
CHANGED
|
@@ -22,15 +22,10 @@ export default class UnlinkCommand extends Command {
|
|
|
22
22
|
*
|
|
23
23
|
* # Decorators
|
|
24
24
|
*
|
|
25
|
-
* If {@link module:link/
|
|
25
|
+
* If {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} is specified,
|
|
26
26
|
* all configured decorators are removed together with the `linkHref` attribute.
|
|
27
27
|
*
|
|
28
28
|
* @fires execute
|
|
29
29
|
*/
|
|
30
30
|
execute(): void;
|
|
31
31
|
}
|
|
32
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
33
|
-
interface CommandsMap {
|
|
34
|
-
unlink: UnlinkCommand;
|
|
35
|
-
}
|
|
36
|
-
}
|
package/src/unlinkcommand.js
CHANGED
|
@@ -36,7 +36,7 @@ export default class UnlinkCommand extends Command {
|
|
|
36
36
|
*
|
|
37
37
|
* # Decorators
|
|
38
38
|
*
|
|
39
|
-
* If {@link module:link/
|
|
39
|
+
* If {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} is specified,
|
|
40
40
|
* all configured decorators are removed together with the `linkHref` attribute.
|
|
41
41
|
*
|
|
42
42
|
* @fires execute
|
|
@@ -9,17 +9,18 @@ import { type ArrayOrItem } from 'ckeditor5/src/utils';
|
|
|
9
9
|
import type { DowncastDispatcher } from 'ckeditor5/src/engine';
|
|
10
10
|
import type { NormalizedLinkDecoratorAutomaticDefinition } from '../utils';
|
|
11
11
|
/**
|
|
12
|
-
* Helper class that ties together all {@link module:link/
|
|
12
|
+
* Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides
|
|
13
13
|
* the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.
|
|
14
14
|
*/
|
|
15
15
|
export default class AutomaticDecorators {
|
|
16
16
|
/**
|
|
17
|
-
* Stores the definition of {@link module:link/
|
|
17
|
+
* Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.
|
|
18
18
|
* This data is used as a source for a downcast dispatcher to create a proper conversion to output data.
|
|
19
19
|
*/
|
|
20
20
|
private _definitions;
|
|
21
21
|
/**
|
|
22
|
-
* Gives information about the number of decorators stored in the {@link module:link/utils~AutomaticDecorators}
|
|
22
|
+
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticDecorators}
|
|
23
|
+
* instance.
|
|
23
24
|
*/
|
|
24
25
|
get length(): number;
|
|
25
26
|
/**
|
|
@@ -7,19 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { toMap } from 'ckeditor5/src/utils';
|
|
9
9
|
/**
|
|
10
|
-
* Helper class that ties together all {@link module:link/
|
|
10
|
+
* Helper class that ties together all {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition} and provides
|
|
11
11
|
* the {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement downcast dispatchers} for them.
|
|
12
12
|
*/
|
|
13
13
|
export default class AutomaticDecorators {
|
|
14
14
|
constructor() {
|
|
15
15
|
/**
|
|
16
|
-
* Stores the definition of {@link module:link/
|
|
16
|
+
* Stores the definition of {@link module:link/linkconfig~LinkDecoratorAutomaticDefinition automatic decorators}.
|
|
17
17
|
* This data is used as a source for a downcast dispatcher to create a proper conversion to output data.
|
|
18
18
|
*/
|
|
19
19
|
this._definitions = new Set();
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Gives information about the number of decorators stored in the {@link module:link/utils~AutomaticDecorators}
|
|
22
|
+
* Gives information about the number of decorators stored in the {@link module:link/utils/automaticdecorators~AutomaticDecorators}
|
|
23
|
+
* instance.
|
|
23
24
|
*/
|
|
24
25
|
get length() {
|
|
25
26
|
return this._definitions.size;
|
|
@@ -13,7 +13,7 @@ declare const ManualDecorator_base: {
|
|
|
13
13
|
prototype: import("ckeditor5/src/utils").Observable;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Helper class that stores manual decorators with observable {@link module:link/utils~ManualDecorator#value}
|
|
16
|
+
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~ManualDecorator#value}
|
|
17
17
|
* to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
|
|
18
18
|
* These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
|
|
19
19
|
*/
|
|
@@ -52,7 +52,7 @@ export default class ManualDecorator extends ManualDecorator_base {
|
|
|
52
52
|
*/
|
|
53
53
|
styles?: Record<string, string>;
|
|
54
54
|
/**
|
|
55
|
-
* Creates a new instance of {@link module:link/utils~ManualDecorator}.
|
|
55
|
+
* Creates a new instance of {@link module:link/utils/manualdecorator~ManualDecorator}.
|
|
56
56
|
*
|
|
57
57
|
* @param config.id The name of the attribute used in the model that represents a given manual decorator.
|
|
58
58
|
* For example: `'linkIsExternal'`.
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ObservableMixin } from 'ckeditor5/src/utils';
|
|
9
9
|
/**
|
|
10
|
-
* Helper class that stores manual decorators with observable {@link module:link/utils~ManualDecorator#value}
|
|
10
|
+
* Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~ManualDecorator#value}
|
|
11
11
|
* to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
|
|
12
12
|
* These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
|
|
13
13
|
*/
|
|
14
14
|
export default class ManualDecorator extends ObservableMixin() {
|
|
15
15
|
/**
|
|
16
|
-
* Creates a new instance of {@link module:link/utils~ManualDecorator}.
|
|
16
|
+
* Creates a new instance of {@link module:link/utils/manualdecorator~ManualDecorator}.
|
|
17
17
|
*
|
|
18
18
|
* @param config.id The name of the attribute used in the model that represents a given manual decorator.
|
|
19
19
|
* For example: `'linkIsExternal'`.
|
package/src/utils.d.ts
CHANGED
|
@@ -31,12 +31,12 @@ export declare function createLinkElement(href: string, { writer }: DowncastConv
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function ensureSafeUrl(url: unknown): string;
|
|
33
33
|
/**
|
|
34
|
-
* Returns the {@link module:link/
|
|
35
|
-
* to respect the locale of the editor, i.e. to display the {@link module:link/
|
|
34
|
+
* Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed
|
|
35
|
+
* to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}
|
|
36
36
|
* in the correct language.
|
|
37
37
|
*
|
|
38
38
|
* **Note**: Only the few most commonly used labels are translated automatically. Other labels should be manually
|
|
39
|
-
* translated in the {@link module:link/
|
|
39
|
+
* translated in the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration.
|
|
40
40
|
*
|
|
41
41
|
* @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
|
|
42
42
|
* @param decorators The decorator reference where the label values should be localized.
|
|
@@ -58,7 +58,7 @@ export declare function isEmail(value: string): boolean;
|
|
|
58
58
|
/**
|
|
59
59
|
* Adds the protocol prefix to the specified `link` when:
|
|
60
60
|
*
|
|
61
|
-
* * it does not contain it already, and there is a {@link module:link/
|
|
61
|
+
* * it does not contain it already, and there is a {@link module:link/linkconfig~LinkConfig#defaultProtocol `defaultProtocol` }
|
|
62
62
|
* configuration value provided,
|
|
63
63
|
* * or the link is an email address.
|
|
64
64
|
*/
|
package/src/utils.js
CHANGED
|
@@ -50,12 +50,12 @@ function isSafeUrl(url) {
|
|
|
50
50
|
return !!normalizedUrl.match(SAFE_URL);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Returns the {@link module:link/
|
|
54
|
-
* to respect the locale of the editor, i.e. to display the {@link module:link/
|
|
53
|
+
* Returns the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration processed
|
|
54
|
+
* to respect the locale of the editor, i.e. to display the {@link module:link/linkconfig~LinkDecoratorManualDefinition label}
|
|
55
55
|
* in the correct language.
|
|
56
56
|
*
|
|
57
57
|
* **Note**: Only the few most commonly used labels are translated automatically. Other labels should be manually
|
|
58
|
-
* translated in the {@link module:link/
|
|
58
|
+
* translated in the {@link module:link/linkconfig~LinkConfig#decorators `config.link.decorators`} configuration.
|
|
59
59
|
*
|
|
60
60
|
* @param t Shorthand for {@link module:utils/locale~Locale#t Locale#t}.
|
|
61
61
|
* @param decorators The decorator reference where the label values should be localized.
|
|
@@ -105,7 +105,7 @@ export function isEmail(value) {
|
|
|
105
105
|
/**
|
|
106
106
|
* Adds the protocol prefix to the specified `link` when:
|
|
107
107
|
*
|
|
108
|
-
* * it does not contain it already, and there is a {@link module:link/
|
|
108
|
+
* * it does not contain it already, and there is a {@link module:link/linkconfig~LinkConfig#defaultProtocol `defaultProtocol` }
|
|
109
109
|
* configuration value provided,
|
|
110
110
|
* * or the link is an email address.
|
|
111
111
|
*/
|