/** * 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.0.11 (2019-07-04) */ !function(v){"use strict";var t,e,n,r,o,i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},a=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=function(t){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(t.settings.plugins)||!a.get("powerpaste")||("undefined"!=typeof v.window.console&&v.window.console.log&&v.window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},u=function(t,e){return{clipboard:t,quirks:e}},f=function(t,e,n,r){return t.fire("PastePreProcess",{content:e,internal:n,wordContent:r})},d=function(t,e,n,r){return t.fire("PastePostProcess",{node:e,internal:n,wordContent:r})},c=function(t,e){return t.fire("PastePlainTextToggle",{state:e})},g=function(t,e){return t.fire("paste",{ieFake:e})},l=function(t,e){"text"===e.pasteFormat.get()?(e.pasteFormat.set("html"),c(t,!1)):(e.pasteFormat.set("text"),c(t,!0)),t.focus()},m=function(t,n){t.addCommand("mceTogglePlainTextPaste",function(){l(t,n)}),t.addCommand("mceInsertClipboardContent",function(t,e){e.content&&n.pasteHtml(e.content,e.internal),e.text&&n.pasteText(e.text)})},p=function(t){return function(){return t}},h=p(!1),y=p(!0),b=h,x=y,P=function(){return w},w=(r={fold:function(t,e){return t()},is:b,isSome:b,isNone:x,getOr:n=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:e,map:P,ap:P,each:function(){},bind:P,flatten:P,exists:b,forall:x,filter:P,equals:t=function(t){return t.isNone()},equals_:t,toArray:function(){return[]},toString:p("none()")},Object.freeze&&Object.freeze(r),r),_=function(n){var t=function(){return n},e=function(){return o},r=function(t){return t(n)},o={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:x,isNone:b,getOr:t,getOrThunk:t,getOrDie:t,getOrNull:t,getOrUndefined:t,or:e,orThunk:e,map:function(t){return _(t(n))},ap:function(t){return t.fold(P,function(t){return _(t(n))})},each:function(t){t(n)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(n)?o:w},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(b,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},T={some:_,none:P,from:function(t){return null===t||t===undefined?w:_(t)}},D=(o="function",function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"===e&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":e}(t)===o}),C=Array.prototype.slice,k=function(t,e){for(var n=t.length,r=new Array(n),o=0;o=a.length&&r(o)}))})})},M=function(t,e){var n=k(t,e);return I(n,F.nu)},B=tinymce.util.Tools.resolve("tinymce.Env"),H=tinymce.util.Tools.resolve("tinymce.util.Delay"),j=tinymce.util.Tools.resolve("tinymce.util.Tools"),L=tinymce.util.Tools.resolve("tinymce.util.VK"),N="x-tinymce/html",$="\x3c!-- "+N+" --\x3e",W=function(t){return $+t},z=function(t){return t.replace($,"")},U=function(t){return-1!==t.indexOf($)},V=function(){return N},q=tinymce.util.Tools.resolve("tinymce.html.Entities"),K=function(t){return t.replace(/\r?\n/g,"
")},G=function(t,e,n){var r=t.split(/\n\n/),o=function(t,e){var n,r=[],o="<"+t;if("object"==typeof e){for(n in e)e.hasOwnProperty(n)&&r.push(n+'="'+q.encodeAllRaw(e[n])+'"');r.length&&(o+=" "+r.join(" "))}return o+">"}(e,n),i="",a=j.map(r,function(t){return t.split(/\n/).join("
")});return 1===a.length?a[0]:j.map(a,function(t){return o+t+i}).join("")},X=function(t){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(t)},Y=function(t,e,n){return e?G(t,!0===e?"p":e,n):K(t)},Z=tinymce.util.Tools.resolve("tinymce.html.DomParser"),J=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=tinymce.util.Tools.resolve("tinymce.html.Schema"),tt=tinymce.util.Tools.resolve("tinymce.html.Serializer"),et={shouldBlockDrop:function(t){return t.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(t){return t.getParam("paste_data_images",!1)},shouldFilterDrop:function(t){return t.getParam("paste_filter_drop",!0)},getPreProcess:function(t){return t.getParam("paste_preprocess")},getPostProcess:function(t){return t.getParam("paste_postprocess")},getWebkitStyles:function(t){return t.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(t){return t.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(t){return t.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(t){return t.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(t){return t.getParam("paste_as_text",!1)},getRetainStyleProps:function(t){return t.getParam("paste_retain_style_properties")},getWordValidElements:function(t){return t.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(t){return t.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(t){return t.getParam("paste_enable_default_filters",!0)}};function nt(e,t){return j.each(t,function(t){e=t.constructor===RegExp?e.replace(t,""):e.replace(t[0],t[1])}),e}var rt={filter:nt,innerText:function te(t){var e=Q(),n=Z({},e),r="",o=e.getShortEndedElements(),i=j.makeMap("script noscript style textarea video audio iframe object"," "),a=e.getBlockElements();return t=nt(t,[//g]),function s(t){var e=t.name,n=t;if("br"!==e){if("wbr"!==e)if(o[e]&&(r+=" "),i[e])r+=" ";else{if(3===t.type&&(r+=t.value),!t.shortEnded&&(t=t.firstChild))for(;s(t),t=t.next;);a[e]&&n.next&&(r+="\n","p"===e&&(r+="\n"))}}else r+="\n"}(n.parse(t)),r},trimHtml:function ee(t){return t=nt(t,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,function r(t,e,n){return e||n?"\xa0":" "}],/
/g,/
$/i])},createIdGenerator:function ne(t){var e=0;return function(){return t+e++}},isMsEdge:function(){return-1!==v.navigator.userAgent.indexOf(" Edge/")}};function ot(e){var n,t;return t=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],e=e.replace(/^[\u00a0 ]+/,""),j.each(t,function(t){if(t.test(e))return!(n=!0)}),n}function it(t){var i,a,s=1;function n(t){var e="";if(3===t.type)return t.value;if(t=t.firstChild)for(;e+=n(t),t=t.next;);return e}function u(t,e){if(3===t.type&&e.test(t.value))return t.value=t.value.replace(e,""),!1;if(t=t.firstChild)do{if(!u(t,e))return!1}while(t=t.next);return!0}function e(t,e,n){var r=t._listLevel||s;r!==s&&(r/gi,/]+id="?docs-internal-[^>]*>/gi,//gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/([\s\u00a0]*)<\/span>/gi,function(t,e){return 0')}),!0);var r,o,i},vt=function(t,e){var n,r;!1===et.isSmartPasteEnabled(t)?ft(t,e):(n=t,r=e,j.each([gt,pt,ft],function(t){return!0!==t(n,r,ft)}))},ht=function(t){return"\n"===t||"\r"===t},yt=function(o){var e,n;return(n={pcIsSpace:!(e=function(t,e){return-1!==" \f\t\x0B".indexOf(e)||"\xa0"===e?t.pcIsSpace||""===t.str||t.str.length===o.length-1||(n=o,(r=t.str.length+1)',!1)}else bt(t,'',!1)}(e,t)})}),!0}return!1},Ct=function(t){return L.metaKeyPressed(t)&&86===t.keyCode||t.shiftKey&&45===t.keyCode},kt=function(u,c,l){var e,f,d=(e=i(T.none()),{clear:function(){e.set(T.none())},set:function(t){e.set(T.some(t))},isSet:function(){return e.get().isSome()},on:function(t){e.get().each(t)}});function m(t,e,n,r){var o,i;wt(t,"text/html")?o=t["text/html"]:(o=c.getHtml(),r=r||U(o),c.isDefaultContent(o)&&(n=!0)),o=rt.trimHtml(o),c.remove(),i=!1===r&&X(o),o.length&&!i||(n=!0),n&&(o=wt(t,"text/plain")&&i?t["text/plain"]:rt.innerText(o)),c.isDefaultContent(o)?e||u.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?xt(u,o):bt(u,o,r)}u.on("keydown",function(t){function e(t){Ct(t)&&!t.isDefaultPrevented()&&c.remove()}if(Ct(t)&&!t.isDefaultPrevented()){if((f=t.shiftKey&&86===t.keyCode)&&B.webkit&&-1!==v.navigator.userAgent.indexOf("Version/"))return;if(t.stopImmediatePropagation(),d.set(t),window.setTimeout(function(){d.clear()},100),B.ie&&f)return t.preventDefault(),void g(u,!0);c.remove(),c.create(),u.once("keyup",e),u.once("paste",function(){u.off("keyup",e)})}});u.on("paste",function(t){var e,n,r,o=d.isSet(),i=(e=u,n=Pt(t.clipboardData||e.getDoc().dataTransfer),rt.isMsEdge()?j.extend(n,{"text/html":""}):n),a="text"===l.get()||f,s=wt(i,V());(f=!1,t.isDefaultPrevented()||(r=t.clipboardData,-1!==v.navigator.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length))?c.remove():_t(i)||!Dt(u,t,c.getLastRng()||u.selection.getRng())?(o||t.preventDefault(),!B.ie||o&&!t.ieFake||wt(i,"text/html")||(c.create(),u.dom.bind(c.getEl(),"paste",function(t){t.stopPropagation()}),u.getDoc().execCommand("Paste",!1,null),i["text/html"]=c.getHtml()),wt(i,"text/html")?(t.preventDefault(),s||(s=U(i["text/html"])),m(i,o,a,s)):H.setEditorTimeout(u,function(){m(i,o,a,s)},0)):c.remove()})},St=function(t){return B.ie&&t.inline?v.document.body:t.getBody()},Ot=function(e,t,n){var r;St(r=e)!==r.getBody()&&e.dom.bind(t,"paste keyup",function(t){Et(e,n)||e.fire("paste")})},At=function(t){return t.dom.get("mcepastebin")},Rt=function(t,e){return e===t},Et=function(t,e){var n,r=At(t);return(n=r)&&"mcepastebin"===n.id&&Rt(e,r.innerHTML)},Ft=function(a){var s=i(null),u="%MCEPASTEBIN%";return{create:function(){return e=s,n=u,o=(t=a).dom,i=t.getBody(),e.set(t.selection.getRng()),r=t.dom.add(St(t),"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),(B.ie||B.gecko)&&o.setStyle(r,"left","rtl"===o.getStyle(i,"direction",!0)?65535:-65535),o.bind(r,"beforedeactivate focusin focusout",function(t){t.stopPropagation()}),Ot(t,r,n),r.focus(),void t.selection.select(r,!0);var t,e,n,r,o,i},remove:function(){return function(t,e){if(At(t)){for(var n=void 0,r=e.get();n=t.dom.get("mcepastebin");)t.dom.remove(n),t.dom.unbind(n);r&&t.selection.setRng(r)}e.set(null)}(a,s)},getEl:function(){return At(a)},getHtml:function(){return function(n){var e,t,r,o,i,a=function(t,e){t.appendChild(e),n.dom.remove(e,!0)};for(t=j.grep(St(n).childNodes,function(t){return"mcepastebin"===t.id}),e=t.shift(),j.each(t,function(t){a(e,t)}),r=(o=n.dom.select("div[id=mcepastebin]",e)).length-1;0<=r;r--)i=n.dom.create("div"),e.insertBefore(i,o[r]),a(i,o[r]);return e?e.innerHTML:""}(a)},getLastRng:function(){return s.get()},isDefault:function(){return Et(a,u)},isDefaultContent:function(t){return Rt(u,t)}}},It=function(n,t){var e=Ft(n);return n.on("PreInit",function(){return kt(a=n,e,t),void a.parser.addNodeFilter("img",function(t,e,n){var r,o=function(t){t.attr("data-mce-object")||s===B.transparentSrc||t.remove()};if(!a.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=t.length;i--;)(s=t[i].attr("src"))&&(0===s.indexOf("webkit-fake-url")?o(t[i]):a.settings.allow_html_data_urls||0!==s.indexOf("data:")||o(t[i]))});var a,s}),{pasteFormat:t,pasteHtml:function(t,e){return bt(n,t,e)},pasteText:function(t){return xt(n,t)},pasteImageData:function(t,e){return Dt(n,t,e)},getDataTransferItems:Pt,hasHtmlOrText:_t,hasContentType:wt}},Mt=function(){},Bt=function(t,e,n){if(r=t,!1!==B.iOS||r===undefined||"function"!=typeof r.setData||!0===rt.isMsEdge())return!1;try{return t.clearData(),t.setData("text/html",e),t.setData("text/plain",n),t.setData(V(),e),!0}catch(o){return!1}var r},Ht=function(t,e,n,r){Bt(t.clipboardData,e.html,e.text)?(t.preventDefault(),r()):n(e.html,r)},jt=function(s){return function(t,e){var n=W(t),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 i=s.selection.getRng();o.focus();var a=s.dom.createRng();a.selectNodeContents(o),s.selection.setRng(a),H.setTimeout(function(){s.selection.setRng(i),r.parentNode.removeChild(r),e()},0)}},Lt=function(t){return{html:t.selection.getContent({contextual:!0}),text:t.selection.getContent({format:"text"})}},Nt=function(t){return!t.selection.isCollapsed()||!!(e=t).dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody());var e},$t=function(t){var e,n;t.on("cut",(e=t,function(t){Nt(e)&&Ht(t,Lt(e),jt(e),function(){H.setTimeout(function(){e.execCommand("Delete")},0)})})),t.on("copy",(n=t,function(t){Nt(n)&&Ht(t,Lt(n),jt(n),Mt)}))},Wt=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),zt=function(t,e){return Wt.getCaretRangeFromPoint(e.clientX,e.clientY,t.getDoc())},Ut=function(t,e){t.focus(),t.selection.setRng(e)},Vt=function(a,s,u){et.shouldBlockDrop(a)&&a.on("dragend dragover draggesture dragdrop drop drag",function(t){t.preventDefault(),t.stopPropagation()}),et.shouldPasteDataImages(a)||a.on("drop",function(t){var e=t.dataTransfer;e&&e.files&&0 [\\s\\r\\n]+|
)*(<\\/?("+n.join("|")+")[^>]*>)(?:
 [\\s\\r\\n]+|
)*","g");return e=rt.filter(e,[[r,"$1"]]),e=rt.filter(e,[[/

/g,"

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

/g,"
"]])}function Xt(t,e,n,r){if(r||n)return e;var c,o=et.getWebkitStyles(t);if(!1===et.shouldRemoveWebKitStyles(t)||"all"===o)return e;if(o&&(c=o.split(/[, ]/)),c){var l=t.dom,f=t.selection.getNode();e=e.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(t,e,n,r){var o=l.parseStyle(l.decode(n)),i={};if("none"===c)return e+r;for(var a=0;a]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return e=e.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(t,e,n,r){return e+' style="'+n+'"'+r})}function Yt(n,t){n.$("a",t).find("font,u").each(function(t,e){n.dom.remove(e,!0)})}var Zt=function(t){B.webkit&&Kt(t,Xt),B.ie&&(Kt(t,Gt),function r(e,n){e.on("PastePostProcess",function(t){n(e,t.node)})}(t,Yt))},Jt=function(n,r){return function(e){e.setActive("text"===r.pasteFormat.get());var t=function(t){return e.setActive(t.state)};return n.on("PastePlainTextToggle",t),function(){return n.off("PastePlainTextToggle",t)}}},Qt=function(t,e){t.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:function(){return t.execCommand("mceTogglePlainTextPaste")},onSetup:Jt(t,e)}),t.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",onAction:function(){return t.execCommand("mceTogglePlainTextPaste")},onSetup:Jt(t,e)})};!function oe(){a.add("paste",function(t){if(!1===s(t)){var e=i(!1),n=i(et.isPasteAsTextEnabled(t)?"text":"html"),r=It(t,n),o=Zt(t);return Qt(t,r),m(t,r),qt(t),$t(t),Vt(t,r,e),u(r,o)}})}()}(window);