/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.4.2 (2020-08-17) */ !function(y){"use strict";var e,t,n,r,m=function(e){var t=e;return{get:function(){return t},set:function(e){t=e}}},c=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=function(e,t){return e.fire("PastePlainTextToggle",{state:t})},f=function(n,r){n.addCommand("mceTogglePlainTextPaste",function(){var e,t;e=n,"text"===(t=r).pasteFormat.get()?(t.pasteFormat.set("html"),o(e,!1)):(t.pasteFormat.set("text"),o(e,!0)),e.focus()}),n.addCommand("mceInsertClipboardContent",function(e,t){t.content&&r.pasteHtml(t.content,t.internal),t.text&&r.pasteText(t.text)})},a=function(e){return function(){return e}},i=a(!1),s=a(!0),u=function(){return l},l=(e=function(e){return e.isNone()},{fold:function(e,t){return e()},is:i,isSome:i,isNone:s,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:a(null),getOrUndefined:a(undefined),or:n,orThunk:t,map:u,each:function(){},bind:u,exists:i,forall:s,filter:u,equals:e,equals_:e,toArray:function(){return[]},toString:a("none()")}),d=function(n){var e=a(n),t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:s,isNone:i,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return d(e(n))},each:function(e){e(n)},bind:r,exists:r,forall:r,filter:function(e){return e(n)?o:l},toArray:function(){return[n]},toString:function(){return"some("+n+")"},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(i,function(e){return t(n,e)})}};return o},p={some:d,none:u,from:function(e){return null===e||e===undefined?l:d(e)}},g=(r="function",function(e){return typeof e===r}),v=Array.prototype.slice,h=function(e,t){for(var n=e.length,r=new Array(n),o=0;o"}(t,n),a="",i=I.map(r,function(e){return e.split(/\n/).join("
")});return 1===i.length?i[0]:I.map(i,function(e){return o+e+a}).join("")},M=tinymce.util.Tools.resolve("tinymce.html.DomParser"),N=tinymce.util.Tools.resolve("tinymce.html.Serializer"),B="\xa0",$=tinymce.util.Tools.resolve("tinymce.html.Node"),j=tinymce.util.Tools.resolve("tinymce.html.Schema");function H(t,e){return I.each(e,function(e){t=e.constructor===RegExp?t.replace(e,""):t.replace(e[0],e[1])}),t}function L(e){var t=j(),n=M({},t),r="",o=t.getShortEndedElements(),a=I.makeMap("script noscript style textarea video audio iframe object"," "),i=t.getBlockElements();return e=H(e,[//g]),function s(e){var t=e.name,n=e;if("br"!==t){if("wbr"!==t)if(o[t]&&(r+=" "),a[t])r+=" ";else{if(3===e.type&&(r+=e.value),!e.shortEnded&&(e=e.firstChild))for(;s(e),e=e.next;);i[t]&&n.next&&(r+="\n","p"===t&&(r+="\n"))}}else r+="\n"}(n.parse(e)),r}function z(e){return e=H(e,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,function r(e,t,n){return t||n?B:" "}],/
/g,/
$/i])}function U(e){return//gi,/]+id="?docs-internal-[^>]*>/gi,//gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,B],[/([\s\u00a0]*)<\/span>/gi,function(e,t){return 0')}),!0);var r,o,a},te=function(e,t,n){var r,o;n||!1===e.getParam("smart_paste",!0)?Z(e,t):(r=e,o=t,I.each([Q,ee,Z],function(e){return!0!==e(r,o,Z)}))},ne=function(e){return"\n"===e||"\r"===e},re=function(e,t){var n,r,o,a,i=(n=" ",(r=e.getParam("paste_tab_spaces",4,"number"))<=0?"":new Array(r+1).join(n)),s=t.replace(/\t/g,i);return(a={pcIsSpace:!(o=function(e,t){return-1!==" \f\t\x0B".indexOf(t)||t===B?e.pcIsSpace||""===e.str||e.str.length===s.length-1||(n=s,(r=e.str.length+1)"));oe(e,s,!1,!0)},se=function(e){var t={};if(e){if(e.getData){var n=e.getData("Text");n&&0',!1)}else ae(e,'',!1)},de=function(t,e,n){var r,o,a,i,s="paste"===e.type?e.clipboardData:e.dataTransfer;if(S(t)&&s){var u=(a=(o=s).items?h(x(o.items),function(e){return e.getAsFile()}):[],i=o.files?x(o.files):[],function(e,t){for(var n=[],r=0,o=e.length;r)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(o),i=J(o);o.length&&(!a||i)||(n=!0),(n||i)&&(o=ue(e,"text/plain")&&a?e["text/plain"]:L(o)),u.isDefaultContent(o)?t||s.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?ie(s,o):ae(s,o,r)}s.on("keydown",function(e){function t(e){me(e)&&!e.isDefaultPrevented()&&u.remove()}if(me(e)&&!e.isDefaultPrevented()){if((c=e.shiftKey&&86===e.keyCode)&&P.webkit&&-1!==y.navigator.userAgent.indexOf("Version/"))return;if(e.stopImmediatePropagation(),f.set(e),window.setTimeout(function(){f.clear()},100),P.ie&&c)return e.preventDefault(),n=!0,void s.fire("paste",{ieFake:n});u.remove(),u.create(),s.once("keyup",t),s.once("paste",function(){s.off("keyup",t)})}var n});s.on("paste",function(e){var t,n,r=f.isSet(),o=(t=s,se(e.clipboardData||t.getDoc().dataTransfer)),a="text"===l.get()||c,i=ue(o,O);(c=!1,e.isDefaultPrevented()||(n=e.clipboardData,-1!==y.navigator.userAgent.indexOf("Android")&&n&&n.items&&0===n.items.length))?u.remove():le(o)||!de(s,e,u.getLastRng()||s.selection.getRng())?(r||e.preventDefault(),!P.ie||r&&!e.ieFake||ue(o,"text/html")||(u.create(),s.dom.bind(u.getEl(),"paste",function(e){e.stopPropagation()}),s.getDoc().execCommand("Paste",!1,null),o["text/html"]=u.getHtml()),ue(o,"text/html")?(e.preventDefault(),i=i||A(o["text/html"]),d(o,r,a,i)):w.setEditorTimeout(s,function(){d(o,r,a,i)},0)):u.remove()})},ge=function(i,e,t){var s;pe(i,e,t),i.parser.addNodeFilter("img",function(e,t,n){var r,o=function(e){e.attr("data-mce-object")||s===P.transparentSrc||e.remove()};if(!S(i)&&((r=n).data&&!0===r.data.paste))for(var a=e.length;a--;)(s=e[a].attr("src"))&&(0===s.indexOf("webkit-fake-url")?o(e[a]):i.getParam("allow_html_data_urls",!1,"boolean")||0!==s.indexOf("data:")||o(e[a]))})},ve=function(e){return P.ie&&e.inline?y.document.body:e.getBody()},he=function(t,e,n){var r;ve(r=t)!==r.getBody()&&t.dom.bind(e,"paste keyup",function(e){xe(t,n)||t.fire("paste")})},ye=function(e){return e.dom.get("mcepastebin")},be=function(e,t){return t===e},xe=function(e,t){var n,r=ye(e);return(n=r)&&"mcepastebin"===n.id&&be(t,r.innerHTML)},Pe=function(e){var t=m(null),n="%MCEPASTEBIN%";return{create:function(){return function(e,t,n){var r=e.dom,o=e.getBody();t.set(e.selection.getRng());var a=e.dom.add(ve(e),"div",{id:"mcepastebin","class":"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},n);(P.ie||P.gecko)&&r.setStyle(a,"left","rtl"===r.getStyle(o,"direction",!0)?65535:-65535),r.bind(a,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),he(e,a,n),a.focus(),e.selection.select(a,!0)}(e,t,n)},remove:function(){return function(e,t){if(ye(e)){for(var n=void 0,r=t.get();n=e.dom.get("mcepastebin");)e.dom.remove(n),e.dom.unbind(n);r&&e.selection.setRng(r)}t.set(null)}(e,t)},getEl:function(){return ye(e)},getHtml:function(){return function(n){var t=function(e,t){e.appendChild(t),n.dom.remove(t,!0)},e=I.grep(ve(n).childNodes,function(e){return"mcepastebin"===e.id}),r=e.shift();I.each(e,function(e){t(r,e)});for(var o=n.dom.select("div[id=mcepastebin]",r),a=o.length-1;0<=a;a--){var i=n.dom.create("div");r.insertBefore(i,o[a]),t(i,o[a])}return r?r.innerHTML:""}(e)},getLastRng:function(){return t.get()},isDefault:function(){return xe(e,n)},isDefaultContent:function(e){return e===n}}},we=function(e,t,n){if(r=e,!1!==P.iOS||"function"!=typeof(null==r?void 0:r.setData))return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(O,t),!0}catch(o){return!1}var r},_e=function(e,t,n,r){we(e.clipboardData,t.html,t.text)?(e.preventDefault(),r()):n(t.html,r)},Te=function(s){return function(e,t){var n=R+e,r=s.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),o=s.dom.create("div",{contenteditable:"true"},n);s.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(o),s.dom.add(s.getBody(),r);var a=s.selection.getRng();o.focus();var i=s.dom.createRng();i.selectNodeContents(o),s.selection.setRng(i),w.setTimeout(function(){s.selection.setRng(a),r.parentNode.removeChild(r),t()},0)}},Ce=function(e){return{html:e.selection.getContent({contextual:!0}),text:e.selection.getContent({format:"text"})}},De=function(e){return!e.selection.isCollapsed()||!!(t=e).dom.getParent(t.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",t.getBody());var t},ke=function(e){var t,n;e.on("cut",(t=e,function(e){De(t)&&_e(e,Ce(t),Te(t),function(){if(P.browser.isChrome()){var e=t.selection.getRng();w.setEditorTimeout(t,function(){t.selection.setRng(e),t.execCommand("Delete")},0)}else t.execCommand("Delete")})})),e.on("copy",(n=e,function(e){De(n)&&_e(e,Ce(n),Te(n),function(){})}))},Se=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),Oe=function(e,t){return Se.getCaretRangeFromPoint(t.clientX,t.clientY,e.getDoc())},Re=function(e,t){e.focus(),e.selection.setRng(t)},Ae=function(i,s,u){i.getParam("paste_block_drop",!1)&&i.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),C(i)||i.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&0 [\\s\\r\\n]+|
)*(<\\/?("+n.join("|")+")[^>]*>)(?:
 [\\s\\r\\n]+|
)*","g"),"$1"]]),t=H(t,[[/

/g,"

"],[/
/g," "],[/

/g,"
"]])}function Ee(e,t,n,r){if(r||n)return t;var l,o=e.getParam("paste_webkit_styles");if(!1===e.getParam("paste_remove_styles_if_webkit",!0)||"all"===o)return t;if(o&&(l=o.split(/[, ]/)),l){var c=e.dom,f=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(e,t,n,r){var o=c.parseStyle(c.decode(n)),a={};if("none"===l)return t+r;for(var i=0;i]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(e,t,n,r){return t+' style="'+n+'"'+r})}function Me(n,e){n.$("a",e).find("font,u").each(function(e,t){n.dom.remove(t,!0)})}var Ne=function(e){P.webkit&&Ie(e,Ee),P.ie&&(Ie(e,Fe),function r(t,n){t.on("PastePostProcess",function(e){n(t,e.node)})}(e,Me))},Be=function(n,r){return function(t){t.setActive("text"===r.pasteFormat.get());var e=function(e){return t.setActive(e.state)};return n.on("PastePlainTextToggle",e),function(){return n.off("PastePlainTextToggle",e)}}};!function je(){c.add("paste",function(e){if(!1==!(!/(^|[ ,])powerpaste([, ]|$)/.test(e.getParam("plugins"))||!c.get("powerpaste")||("undefined"!=typeof y.window.console&&y.window.console.log&&y.window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))){var t=m(!1),n=m(e.getParam("paste_as_text",!1)?"text":"html"),r=(u=n,l=Pe(s=e),s.on("PreInit",function(){return ge(s,l,u)}),{pasteFormat:u,pasteHtml:function(e,t){return ae(s,e,t)},pasteText:function(e){return ie(s,e)},pasteImageData:function(e,t){return de(s,e,t)},getDataTransferItems:se,hasHtmlOrText:le,hasContentType:ue}),o=Ne(e);return i=r,(a=e).ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:function(){return a.execCommand("mceTogglePlainTextPaste")},onSetup:Be(a,i)}),a.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:function(){return a.execCommand("mceTogglePlainTextPaste")},onSetup:Be(a,i)}),f(e,r),function(e){var t=e.plugins.paste,n=e.getParam("paste_preprocess");n&&e.on("PastePreProcess",function(e){n.call(t,t,e)});var r=e.getParam("paste_postprocess");r&&e.on("PastePostProcess",function(e){r.call(t,t,e)})}(e),ke(e),Ae(e,r,t),{clipboard:r,quirks:o}}var a,i,s,u,l})}()}(window);