tinymce
Version:
Web based JavaScript HTML WYSIWYG editor control.
1 lines • 18.7 kB
JavaScript
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(n=o=e,(r=String).prototype.isPrototypeOf(n)||o.constructor?.name===r.name)?"string":t;var n,o,r})(t)===e,n=e=>t=>typeof t===e,o=t("string"),r=t("object"),l=t("array"),a=e=>null===e;const s=n("boolean"),i=e=>!(e=>null==e)(e),c=n("function"),u=(e,t)=>{if(l(e)){for(let n=0,o=e.length;n<o;++n)if(!t(e[n]))return!1;return!0}return!1},g=()=>{},d=e=>e,m=(e,t)=>e===t;class h{tag;value;static singletonNone=new h(!1);constructor(e,t){this.tag=e,this.value=t}static some(e){return new h(!0,e)}static none(){return h.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?h.some(e(this.value)):h.none()}bind(e){return this.tag?e(this.value):h.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:h.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(e??"Called getOrDie on None")}static from(e){return i(e)?h.some(e):h.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}Array.prototype.slice;const p=Array.prototype.indexOf,f=Array.prototype.push,k=e=>{const t=[];for(let n=0,o=e.length;n<o;++n){if(!l(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);f.apply(t,e[n])}return t};c(Array.from)&&Array.from;const b=(e,t)=>{for(let n=0;n<e.length;n++){const o=t(e[n],n);if(o.isSome())return o}return h.none()},v=Object.keys,y=Object.hasOwnProperty,x=(e,t)=>y.call(e,t),_=(e,t,n=m)=>e.exists((e=>n(e,t))),w=e=>{const t=[],n=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(n);return t},C=(e,t)=>e?h.some(t):h.none(),O=e=>t=>t.options.get(e),A=O("link_assume_external_targets"),S=O("link_context_toolbar"),N=O("link_list"),E=O("link_default_target"),R=O("link_default_protocol"),T=O("link_target_list"),L=O("link_rel_list"),P=O("link_class_list"),U=O("link_title"),B=O("allow_unsafe_link_target"),D=O("link_quicklink"),M=O("link_attributes_postprocess"),j=O("files_upload_handler"),I=O("link_uploadtab"),F=O("documents_file_types");var K=tinymce.util.Tools.resolve("tinymce.util.URI"),q=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),$=tinymce.util.Tools.resolve("tinymce.util.Tools");const V=e=>i(e)&&"a"===e.nodeName.toLowerCase(),z=e=>V(e)&&!!J(e),G=(e,t)=>{if(e.collapsed)return[];{const n=e.cloneContents(),o=n.firstChild,r=new q(o,n),l=[];let a=o;do{t(a)&&l.push(a)}while(a=r.next());return l}},H=e=>/^\w+:/i.test(e),J=e=>e.getAttribute("data-mce-href")??e.getAttribute("href")??"",W=(e,t)=>{const n=["noopener"],o=e?e.split(/\s+/):[],r=e=>e.filter((e=>-1===$.inArray(n,e))),l=t?(e=>(e=r(e)).length>0?e.concat(n):n)(o):r(o);return l.length>0?(e=>$.trim(e.sort().join(" ")))(l):""},Q=(e,t)=>(t=t||Z(e.selection.getRng())[0]||e.selection.getNode(),oe(t)?h.from(e.dom.select("a[href]",t)[0]):h.from(e.dom.getParent(t,"a[href]"))),X=(e,t)=>Q(e,t).isSome(),Y=(e,t)=>t.fold((()=>e.getContent({format:"text"})),(e=>e.innerText||e.textContent||"")).replace(/\uFEFF/g,""),Z=e=>G(e,z),ee=e=>$.grep(e,z),te=e=>ee(e).length>0,ne=e=>{const t=e.schema.getTextInlineElements();if(Q(e).exists((e=>e.hasAttribute("data-mce-block"))))return!1;const n=e.selection.getRng();return!!n.collapsed||0===G(n,(e=>1===e.nodeType&&!V(e)&&!x(t,e.nodeName.toLowerCase()))).length},oe=e=>i(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),re=(e,t,n)=>{const o=e.selection.getNode(),r=Q(e,o),l=((e,t)=>{const n={...t};if(0===L(e).length&&!B(e)){const e=W(n.rel,"_blank"===n.target);n.rel=e||null}return h.from(n.target).isNone()&&!1===T(e)&&(n.target=E(e)),n.href=((e,t)=>"http"!==t&&"https"!==t||H(e)?e:t+"://"+e)(n.href,A(e)),n})(e,(e=>{return t=["title","rel","class","target"],n=(t,n)=>(e[n].each((e=>{t[n]=e.length>0?e:null})),t),o={href:e.href},((e,t)=>{for(let n=0,o=e.length;n<o;n++)t(e[n],n)})(t,((e,t)=>{o=n(o,e)})),o;var t,n,o})(n)),a=M(e);i(a)&&a(l),e.undoManager.transact((()=>{n.href===t.href&&t.attach(),r.fold((()=>{((e,t,n,o)=>{const r=e.dom;oe(t)?ce(r,t,o):n.fold((()=>{e.execCommand("mceInsertLink",!1,o);const t=e.selection.getEnd(),n=r.createRng();n.setStartAfter(t),n.setEndAfter(t),e.selection.setRng(n)}),(t=>{e.insertContent(r.createHTML("a",o,r.encode(t)))}))})(e,o,n.text,l)}),(t=>{e.focus(),((e,t,n,o)=>{n.each((e=>{x(t,"innerText")?t.innerText=e:t.textContent=e})),e.dom.setAttribs(t,o);const r=e.dom.createRng();r.setStartAfter(t),r.setEndAfter(t),e.selection.setRng(r)})(e,t,n.text,l)}))}))},le=e=>{const{class:t,href:n,rel:o,target:r,text:l,title:s}=e;return(e=>{const t={};var n;return((e,t,n,o)=>{((e,t)=>{const n=v(e);for(let o=0,r=n.length;o<r;o++){const r=n[o];t(e[r],r)}})(e,((e,r)=>{(t(e,r)?n:o)(e,r)}))})(e,((e,t)=>!1===a(e)),(n=t,(e,t)=>{n[t]=e}),g),t})({class:t.getOrNull(),href:n,rel:o.getOrNull(),target:r.getOrNull(),text:l.getOrNull(),title:s.getOrNull()})},ae=(e,t,n)=>{const o=((e,t)=>{const n=e.options.get,o={allow_html_data_urls:n("allow_html_data_urls"),allow_script_urls:n("allow_script_urls"),allow_svg_data_urls:n("allow_svg_data_urls")},r=t.href;return{...t,href:K.isDomSafe(r,"a",o)?r:""}})(e,n);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,le(o)):re(e,t,o)},se=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact((()=>{const t=e.selection.getNode();oe(t)?ie(e,t):(e=>{const t=e.dom,n=e.selection,o=n.getBookmark(),r=n.getRng().cloneRange(),l=t.getParent(r.startContainer,"a[href]",e.getBody()),a=t.getParent(r.endContainer,"a[href]",e.getBody());l&&r.setStartBefore(l),a&&r.setEndAfter(a),n.setRng(r),e.execCommand("unlink"),n.moveToBookmark(o)})(e),e.focus()}))})(e)},ie=(e,t)=>{const n=e.dom.select("img",t)[0];if(n){const o=e.dom.getParents(n,"a[href]",t)[0];o&&(o.parentNode?.insertBefore(n,o),e.dom.remove(o))}},ce=(e,t,n)=>{const o=e.select("img",t)[0];if(o){const t=e.create("a",n);o.parentNode?.insertBefore(t,o),t.appendChild(o)}},ue=e=>o(e.value)?e.value:"",ge=(e,t)=>{const n=[];return $.each(e,(e=>{const r=(e=>o(e.text)?e.text:o(e.title)?e.title:"")(e);if(void 0!==e.menu){const o=ge(e.menu,t);n.push({text:r,items:o})}else{const o=t(e);n.push({text:r,value:o})}})),n},de=(e=ue)=>t=>h.from(t).map((t=>ge(t,e))),me=e=>de(ue)(e),he=de,pe=(e,t)=>n=>({name:e,type:"listbox",label:t,items:n}),fe=ue,ke=(e,t)=>b(t,(t=>(e=>{return x(t=e,n="items")&&void 0!==t[n]&&null!==t[n];var t,n})(t)?ke(e,t.items):C(t.value===e,t))),be=(e,t)=>{const n={text:e.text,title:e.title},o=(e,o)=>{const r=(l=t,a=o,"link"===a?l.link:"anchor"===a?l.anchor:h.none()).getOr([]);var l,a;return((e,t,n,o)=>{const r=o[t],l=e.length>0;return void 0!==r?ke(r,n).map((t=>({url:{value:t.value,meta:{text:l?e:t.text,attach:g}},text:l?e:t.text}))):h.none()})(n.text,o,r,e)};return{onChange:(e,t)=>{const r=t.name;return"url"===r?(e=>{const t=(o=e.url,C(n.text.length<=0,h.from(o.meta?.text).getOr(o.value)));var o;const r=(e=>C(n.title.length<=0,h.from(e.meta?.title).getOr("")))(e.url);return t.isSome()||r.isSome()?h.some({...t.map((e=>({text:e}))).getOr({}),...r.map((e=>({title:e}))).getOr({})}):h.none()})(e()):((e,t)=>p.call(e,t))(["anchor","link"],r)>-1?o(e(),r):"text"===r||"title"===r?(n[r]=e()[r],h.none()):h.none()}}};var ve=tinymce.util.Tools.resolve("tinymce.util.Delay");const ye=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?h.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):h.none()},xe=(e,t)=>n=>{const o=n.href;return 1===e&&!H(o)||0===e&&/^\s*www(\.|\d\.)/i.test(o)?h.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+o})}):h.none()},_e=e=>{const t=e.dom.select("a:not([href])"),n=k(((e,t)=>{const n=e.length,o=new Array(n);for(let r=0;r<n;r++){const n=e[r];o[r]=t(n,r)}return o})(t,(e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]})));return n.length>0?h.some([{text:"None",value:""}].concat(n)):h.none()},we=e=>{const t=P(e);return t.length>0?me(t):h.none()},Ce=e=>{try{return h.some(JSON.parse(e))}catch{return h.none()}},Oe=(e,t)=>{const n=L(e);if(n.length>0){const o=_(t,"_blank"),r=e=>W(fe(e),o);return(!1===B(e)?he(r):me)(n)}return h.none()},Ae=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Se=e=>{const t=T(e);return l(t)?me(t).orThunk((()=>h.some(Ae))):!1===t?h.none():h.some(Ae)},Ne=(e,t,n)=>{const o=e.getAttrib(t,n);return null!==o&&o.length>0?h.some(o):h.none()},Ee=(e,t)=>(e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),n=N(e);return new Promise((e=>{o(n)?fetch(n).then((e=>e.ok?e.text().then(Ce):Promise.reject())).then(e,(()=>e(h.none()))):c(n)?n((t=>e(h.some(t)))):e(h.from(n))})).then((e=>e.bind(he(t)).map((e=>e.length>0?[{text:"None",value:""}].concat(e):e))))})(e).then((n=>{const o=(e=>i(e.options.get("files_upload_handler")))(e)&&(e=>i(e.options.get("documents_file_types")))(e)&&I(e),r=((e,t)=>{const n=e.dom,o=ne(e)?h.some(Y(e.selection,t)):h.none(),r=t.bind((e=>h.from(n.getAttrib(e,"href")))),l=t.bind((e=>h.from(n.getAttrib(e,"target")))),a=t.bind((e=>Ne(n,e,"rel"))),s=t.bind((e=>Ne(n,e,"class")));return{url:r,text:o,title:t.bind((e=>Ne(n,e,"title"))),target:l,rel:a,linkClass:s}})(e,t);return{anchor:r,catalogs:{targets:Se(e),rels:Oe(e,r.target),classes:we(e),anchor:_e(e),link:n},hasUploadPanel:o,optNode:t,flags:{titleEnabled:U(e)}}})),Re=e=>({title:"Upload",name:"upload",items:[{type:"dropzone",name:"fileinput",buttonLabel:"Browse for a file",dropAreaLabel:"Drop a file here",allowedFileTypes:e.map((e=>e.mimeType)).join(","),allowedFileExtensions:k(e.map((e=>e.extensions)))}]}),Te=e=>(t,n)=>j(e)(t,n),Le=(e,t)=>{const n=t.getData();var o;t.block("Uploading file"),(o=n.fileinput,(e=>0<e.length?h.some(e[0]):h.none())(o)).fold((()=>{t.unblock()}),(n=>{const o=URL.createObjectURL(n),r=()=>{t.unblock(),URL.revokeObjectURL(o)};var l;(l=n,new Promise(((e,t)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=()=>{t(new Error(n.error?.message??"Failed to convert blob to a data url"))},n.readAsDataURL(l)}))).then((t=>{const r=e.getExistingBlobInfo((e=>h.from(e.split(",")[1]).getOr(""))(t),n.type),l=r&&r.filename()===n.name?r:e.createBlobCache(n,o,t);return e.addToBlobCache(l),e.uploadFile(l,d)})).then((e=>{(({url:e,fileName:n})=>{t.setData({text:n,title:n,url:{value:e,meta:{}}}),t.showTab("general"),t.focus("url")})(e),r()})).catch((n=>{r(),e.alertErr(n,(()=>{t.focus("fileinput")}))}))}))},Pe=e=>(t,n,o)=>e.editorUpload.blobCache.create({blob:t,blobUri:n,name:t.name?.replace(/\.[^\.]+$/,""),filename:t.name,base64:o.split(",")[1]}),Ue=e=>t=>{e.editorUpload.blobCache.add(t)},Be=e=>(t,n)=>e.editorUpload.blobCache.getByData(t,n),De=e=>(t,n)=>{e.windowManager.alert(t,n)},Me=e=>{const t=(e=>{const t=Q(e);return Ee(e,t)})(e);t.then((t=>{const n=((e,t)=>n=>{const o=n.getData();if(!o.url.value)return se(e),void n.close();const r=e=>h.from(o[e]).filter((n=>!_(t.anchor[e],n))),l={href:o.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},a={href:o.url.value,attach:void 0!==o.url.meta&&o.url.meta.attach?o.url.meta.attach:g};((e,t)=>b([ye,xe(A(e),R(e))],(e=>e(t))).fold((()=>Promise.resolve(t)),(n=>new Promise((o=>{((e,t,n)=>{const o=e.selection.getRng();ve.setEditorTimeout(e,(()=>{e.windowManager.confirm(t,(t=>{e.selection.setRng(o),n(t)}))}))})(e,n.message,(e=>{o(e?n.preprocess(t):t)}))})))))(e,l).then((t=>{ae(e,a,t)})),n.close()})(e,t);return((e,t,n)=>{const o=e.anchor.text.map((()=>({name:"text",type:"input",label:"Text to display"}))).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],l=((e,t)=>{const n=e.anchor,o=n.url.getOr("");return{url:{value:o,meta:{original:{value:o}}},text:n.text.getOr(""),title:n.title.getOr(""),anchor:o,link:o,rel:n.rel.getOr(""),target:n.target.or(t).getOr(""),linkClass:n.linkClass.getOr(""),fileinput:[]}})(e,h.from(E(n))),a=e.catalogs,s=be(l,a),i=((e,t,n,o,r,l)=>{const a=k([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],t,n,w([o.anchor.map(pe("anchor","Anchors")),o.rels.map(pe("rel","Rel")),o.targets.map(pe("target","Open link in...")),o.link.map(pe("link","Link list")),o.classes.map(pe("linkClass","Class"))])]);return r?{type:"tabpanel",tabs:k([[{title:"General",name:"general",items:a}],[Re(l)]])}:{type:"panel",items:a}})(0,o,r,a,e.hasUploadPanel,F(n)),c={addToBlobCache:Ue(n),createBlobCache:Pe(n),alertErr:De(n),uploadFile:Te(n),getExistingBlobInfo:Be(n)};return{title:"Insert/Edit Link",size:"normal",body:i,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:l,onChange:(e,{name:t})=>{"fileinput"===t?Le(c,e):s.onChange(e.getData,{name:t}).each((t=>{e.setData(t)}))},onSubmit:t}})(t,n,e)})).then((t=>{e.windowManager.open(t)}))};var je=tinymce.util.Tools.resolve("tinymce.util.VK");const Ie=(e,t)=>{if(t){const o=J(t);if(/^#/.test(o)){const t=e.dom.select(`${o},[name="${n=o,((e,t)=>((e,t)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t))(n,"#")?(e=>e.substring(1))(n):n}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else(e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});document.dispatchEvent(n),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,n)})(t.href)}var n},Fe=(e,t)=>{const n=ee(e.dom.getParents(t));return C(1===n.length,n[0])},Ke=e=>e.selection.isCollapsed()||(e=>{const t=e.selection.getRng(),n=t.startContainer;return z(n)&&t.startContainer===t.endContainer&&1===e.dom.select("img",n).length})(e)?Fe(e,e.selection.getStart()):(e=>{const t=Z(e.selection.getRng());return C(t.length>0,t[0]).or(Fe(e,e.selection.getNode()))})(e),qe=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},$e=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Ve=e=>t=>{const n=()=>{t.setActive(!e.mode.isReadOnly()&&X(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return n(),$e(e,n)},ze=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return n(),$e(e,n)},Ge=e=>t=>{const n=e.dom.getParents(e.selection.getStart()),o=n=>{t.setEnabled((t=>{return te(t)||(n=e.selection.getRng(),Z(n).length>0);var n})(n)&&e.selection.isEditable())};return o(n),$e(e,(e=>o(e.parents)))},He=e=>{const t=(e=>{const t=(()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(h.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(h.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(h.some(e))}}})(g);return{...e,on:t=>e.get().each(t)}})(),n=()=>t.get().or(Ke(e));return e.on("contextmenu",(n=>{Fe(e,n.target).each(t.set)})),e.on("SelectionChange",(()=>{t.isSet()||Ke(e).each(t.set)})),e.on("click",(n=>{t.clear();const o=ee(e.dom.getParents(n.target));1===o.length&&je.metaKeyPressed(n)&&(n.preventDefault(),Ie(e,o[0]))})),e.on("keydown",(o=>{t.clear(),!o.isDefaultPrevented()&&13===o.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(o)&&n().each((t=>{o.preventDefault(),Ie(e,t)}))})),{gotoSelectedLink:()=>n().each((t=>Ie(e,t)))}})(e);((e,t)=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onAction:qe(e),onSetup:Ve(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:t.gotoSelectedLink,onSetup:Ge(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>se(e),onSetup:Ge(e)})})(e,t),((e,t)=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:t.gotoSelectedLink,onSetup:Ge(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onAction:qe(e),onSetup:ze(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>se(e),onSetup:Ge(e)})})(e,t),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?te(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),((e,t)=>{const n=t=>{const n=e.selection.getNode();return t.setEnabled(X(e,n)&&e.selection.isEditable()),g};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Ve(e)},label:"Link",predicate:t=>S(e)&&X(e,t),initValue:()=>Q(e).fold((()=>""),J),commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const n=e.selection.getNode();return t.setActive(X(e,n)),Ve(e)(t)},onAction:t=>{const n=t.getValue(),o=(t=>{const n=Q(e),o=ne(e);if(n.isNone()&&o){const o=Y(e.selection,n);return C(0===o.length,t)}return h.none()})(n);ae(e,{href:n,attach:g},{href:n,text:o,title:h.none(),rel:h.none(),target:h.from(E(e)),class:h.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:n,onAction:t=>{se(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:n,onAction:e=>{t.gotoSelectedLink(),e.hide()}}]})})(e,t)};e.add("link",(e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=o(e)||s(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>o(e)||c(e)||u(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>s(e)||u(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1}),t("link_attributes_postprocess",{processor:"function"}),t("files_upload_handler",{processor:"function"}),t("link_uploadtab",{processor:"boolean",default:!0})})(e),(e=>{e.addCommand("mceLink",((t,n)=>{!0!==n?.dialog&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Me(e)}))})(e),He(e),(e=>{e.addShortcut("Meta+K","",(()=>{e.execCommand("mceLink")}))})(e)}))}();