vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js in tinymce-rails-6.1.1 vs vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js in tinymce-rails-6.1.2

- old
+ new

@@ -1,4 +1,4 @@ /** - * TinyMCE version 6.1.1 (2022-07-27) + * TinyMCE version 6.1.2 (2022-07-29) */ -!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager");const t=e=>t=>t.options.get(e),n=t("autolink_pattern"),o=t("link_default_target"),r=t("link_default_protocol"),i=("string",e=>"string"===(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)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var n,o,r,i})(e));const s=e=>!(e=>null==e)(e),a=e=>/^[(\[{ \u00a0]$/.test(e),l=e=>3===e.nodeType,d=e=>1===e.nodeType,c=(e,t)=>{if(t<0&&(t=0),l(e)){const n=e.data.length;t>n&&(t=n)}return t},f=(e,t,n)=>{!d(t)||t.hasChildNodes()?e.setStart(t,c(t,n)):e.setStartBefore(t)},g=(e,t,n)=>{!d(t)||t.hasChildNodes()?e.setEnd(t,c(t,n)):e.setEndAfter(t)},u=(e,t)=>{let o,i,s,d,c,u;const h=n(e);if(null!==e.dom.getParent(e.selection.getNode(),"a[href]"))return;const m=e.selection.getRng().cloneRange();if(m.startOffset<5){if(d=m.endContainer.previousSibling,!d){if(!m.endContainer.firstChild||!m.endContainer.firstChild.nextSibling)return;d=m.endContainer.firstChild.nextSibling}if(c=d.length,f(m,d,c),g(m,d,c),m.endOffset<5)return;o=m.endOffset,i=d}else{if(i=m.endContainer,!l(i)&&i.firstChild){for(;!l(i)&&i.firstChild;)i=i.firstChild;l(i)&&(f(m,i,0),g(m,i,i.nodeValue.length))}o=1===m.endOffset?2:m.endOffset-1-t}const p=o;do{f(m,i,o>=2?o-2:0),g(m,i,o>=1?o-1:0),o-=1,u=m.toString()}while(!a(u)&&o-2>=0);var C;a(m.toString())?(f(m,i,o),g(m,i,p),o+=1):0===m.startOffset?(f(m,i,0),g(m,i,p)):(f(m,i,o),g(m,i,p)),s=m.toString(),C=s.charAt(s.length-1),/[?!,.;:]/.test(C)&&g(m,i,p-1),s=m.toString().trim();const k=s.match(h),y=r(e);if(k){let e=k[0];return v="www.",(w=e).length>=v.length&&w.substr(0,0+v.length)===v?e=y+"://"+e:((e,t)=>-1!==e.indexOf("@"))(e)&&!(e=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(e))(e)&&(e="mailto:"+e),{rng:m,url:e}}var w,v;return null},h=(e,t)=>{const n=o(e),{rng:r,url:s}=t;e.undoManager.transact((()=>{const t=e.selection.getBookmark();e.selection.setRng(r);const o="createlink",a={command:o,ui:!1,value:s};e.dispatch("BeforeExecCommand",a).isDefaultPrevented()||(e.getDoc().execCommand(o,!1,s),e.dispatch("ExecCommand",a),i(n)&&e.dom.setAttrib(e.selection.getNode(),"target",n)),e.selection.moveToBookmark(t),e.nodeChanged()}))},m=e=>{const t=u(e,0);s(t)&&h(e,t)},p=m;e.add("autolink",(e=>{(e=>{const t=e.options.register;t("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"})})(e),(e=>{e.on("keydown",(t=>{13!==t.keyCode||t.isDefaultPrevented()||((e,t)=>{const n=u(e,-1);s(n)&&(t.preventDefault(),e.execCommand("mceInsertNewLine",!1,t),h(e,n))})(e,t)})),e.on("keyup",(t=>{32===t.keyCode?m(e):(48===t.keyCode&&t.shiftKey||221===t.keyCode)&&p(e)}))})(e)}))}(); +!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>e.options.get(t),n=e("autolink_pattern"),o=e("link_default_target"),r=e("link_default_protocol"),i=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=o=t,(r=String).prototype.isPrototypeOf(n)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var n,o,r,i})(t));const s=t=>!(t=>null==t)(t),l=t=>/^[(\[{ \u00a0]$/.test(t),a=t=>3===t.nodeType,d=t=>1===t.nodeType,c=(t,e)=>{if(e<0&&(e=0),a(t)){const n=t.data.length;e>n&&(e=n)}return e},f=(t,e,n)=>{!d(e)||e.hasChildNodes()?t.setStart(e,c(e,n)):t.setStartBefore(e)},g=(t,e,n)=>{!d(e)||e.hasChildNodes()?t.setEnd(e,c(e,n)):t.setEndAfter(e)},u=(t,e)=>{let o,i,s,d,c,u;const h=n(t);if(null!==t.dom.getParent(t.selection.getNode(),"a[href]"))return;const p=t.selection.getRng().cloneRange();if(p.startOffset<5){if(d=p.endContainer.previousSibling,!d){if(!p.endContainer.firstChild||!p.endContainer.firstChild.nextSibling)return;d=p.endContainer.firstChild.nextSibling}if(c=d.length,f(p,d,c),g(p,d,c),p.endOffset<5)return;o=p.endOffset,i=d}else{if(i=p.endContainer,!a(i)&&i.firstChild){for(;!a(i)&&i.firstChild;)i=i.firstChild;a(i)&&(f(p,i,0),g(p,i,i.nodeValue.length))}o=1===p.endOffset?2:p.endOffset-1-e}const m=o;do{f(p,i,o>=2?o-2:0),g(p,i,o>=1?o-1:0),o-=1,u=p.toString()}while(!l(u)&&o-2>=0);var C;l(p.toString())?(f(p,i,o),g(p,i,m),o+=1):0===p.startOffset?(f(p,i,0),g(p,i,m)):(f(p,i,o),g(p,i,m)),s=p.toString(),C=s.charAt(s.length-1),/[?!,.;:]/.test(C)&&g(p,i,m-1),s=p.toString().trim();const k=s.match(h),y=r(t);if(k){let t=k[0];return v="www.",(w=t).length>=v.length&&w.substr(0,0+v.length)===v?t=y+"://"+t:((t,e)=>-1!==t.indexOf("@"))(t)&&!(t=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(t))(t)&&(t="mailto:"+t),{rng:p,url:t}}var w,v;return null},h=(t,e)=>{const n=o(t),{rng:r,url:s}=e,l=t.selection.getBookmark();t.selection.setRng(r);const a="createlink",d={command:a,ui:!1,value:s};t.dispatch("BeforeExecCommand",d).isDefaultPrevented()||(t.getDoc().execCommand(a,!1,s),t.dispatch("ExecCommand",d),i(n)&&t.dom.setAttrib(t.selection.getNode(),"target",n)),t.selection.moveToBookmark(l),t.nodeChanged()},p=t=>{const e=u(t,0);s(e)&&h(t,e)},m=p;t.add("autolink",(t=>{(t=>{const e=t.options.register;e("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),e("link_default_target",{processor:"string"}),e("link_default_protocol",{processor:"string",default:"https"})})(t),(t=>{t.on("keydown",(e=>{13!==e.keyCode||e.isDefaultPrevented()||(t=>{const e=u(t,-1);s(e)&&h(t,e)})(t)})),t.on("keyup",(e=>{32===e.keyCode?p(t):(48===e.keyCode&&e.shiftKey||221===e.keyCode)&&m(t)}))})(t)}))}(); \ No newline at end of file