src/myams/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.js
changeset 0 f05d7aea098a
child 5 c9c69b13d884
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/myams/resources/js/ext/tinymce/dev/plugins/paste/plugin.min.js	Fri Jul 10 16:59:11 2020 +0200
@@ -0,0 +1,1 @@
+(function(b,g){var d={};function c(m,n){var l,j=[];for(var k=0;k<m.length;++k){l=d[m[k]]||e(m[k]);if(!l){throw"module definition dependecy not found: "+m[k]}j.push(l)}n.apply(null,j)}function h(k,j,i){if(typeof k!=="string"){throw"invalid module definition, module id must be defined and be a string"}if(j===g){throw"invalid module definition, dependencies must be specified"}if(i===g){throw"invalid module definition, definition function must be specified"}c(j,function(){d[k]=i.apply(null,arguments)})}function f(i){return !!d[i]}function e(l){var j=b;var i=l.split(/[.\/]/);for(var k=0;k<i.length;++k){if(!j[i[k]]){return}j=j[i[k]]}return j}function a(l){for(var k=0;k<l.length;k++){var m=b;var o=l[k];var j=o.split(/[.\/]/);for(var n=0;n<j.length-1;++n){if(m[j[n]]===g){m[j[n]]={}}m=m[j[n]]}m[j[j.length-1]]=d[o]}}h("tinymce/pasteplugin/Utils",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema"],function(i,n,l){function k(p,o){i.each(o,function(q){if(q.constructor==RegExp){p=p.replace(q,"")}else{p=p.replace(q[0],q[1])}});return p}function m(r){var t=new l(),v=new n({},t),u="";var q=t.getShortEndedElements();var p=i.makeMap("script noscript style textarea video audio iframe object"," ");var s=t.getBlockElements();function o(y){var w=y.name,x=y;if(w==="br"){u+="\n";return}if(q[w]){u+=" "}if(p[w]){u+=" ";return}if(y.type==3){u+=y.value}if(!y.shortEnded){if((y=y.firstChild)){do{o(y)}while((y=y.next))}}if(s[w]&&x.next){u+="\n";if(w=="p"){u+="\n"}}}r=k(r,[/<!\[[^\]]+\]>/g]);o(v.parse(r));return u}function j(o){function p(s,r,q){if(!r&&!q){return" "}return"\u00a0"}o=k(o,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,p],/<br>$/i]);return o}return{filter:k,innerText:m,trimHtml:j}});h("tinymce/pasteplugin/Clipboard",["tinymce/Env","tinymce/dom/RangeUtils","tinymce/util/VK","tinymce/pasteplugin/Utils"],function(i,j,l,k){return function(q){var y=this,o,D,n=0,C=false;var r="%MCEPASTEBIN%",E;var s="data:text/mce-internal,";function A(K){var J,L=q.dom;J=q.fire("BeforePastePreProcess",{content:K});J=q.fire("PastePreProcess",J);K=J.content;if(!J.isDefaultPrevented()){if(q.hasEventListeners("PastePostProcess")&&!J.isDefaultPrevented()){var I=L.add(q.getBody(),"div",{style:"display:none"},K);J=q.fire("PastePostProcess",{node:I});L.remove(I);K=J.node.innerHTML}if(!J.isDefaultPrevented()){q.insertContent(K,{merge:q.settings.paste_merge_formats!==false})}}}function B(L){L=q.dom.encode(L).replace(/\r\n/g,"\n");var J=q.dom.getParent(q.selection.getStart(),q.dom.isBlock);var I=q.settings.forced_root_block;var K;if(I){K=q.dom.createHTML(I,q.settings.forced_root_block_attrs);K=K.substr(0,K.length-3)+">"}if((J&&/^(PRE|DIV)$/.test(J.nodeName))||!I){L=k.filter(L,[[/\n/g,"<br>"]])}else{L=k.filter(L,[[/\n\n/g,"</p>"+K],[/^(.*<\/p>)(<p>)$/,K+"$1"],[/\n/g,"<br />"]]);if(L.indexOf("<p>")!=-1){L=K+L}}A(L)}function t(){var K=q.dom,L=q.getBody();var M=q.dom.getViewPort(q.getWin()),J=M.y,O=20;var Q;D=q.selection.getRng();if(q.inline){Q=q.selection.getScrollContainer();if(Q&&Q.scrollTop>0){J=Q.scrollTop}}function N(S){var T,V,U,R=S.startContainer;T=S.getClientRects();if(T.length){return T[0]}if(!S.collapsed||R.nodeType!=1){return}U=R.childNodes[D.startOffset];while(U&&U.nodeType==3&&!U.data.length){U=U.nextSibling}if(!U){return}if(U.tagName=="BR"){V=K.doc.createTextNode("\uFEFF");U.parentNode.insertBefore(V,U);S=K.createRng();S.setStartBefore(V);S.setEndAfter(V);T=S.getClientRects();K.remove(V)}if(T.length){return T[0]}}if(D.getClientRects){var P=N(D);if(P){O=J+(P.top-K.getPos(L).y)}else{O=J;var I=D.startContainer;if(I){if(I.nodeType==3&&I.parentNode!=L){I=I.parentNode}if(I.nodeType==1){O=K.getPos(I,Q||L).y}}}}o=K.add(q.getBody(),"div",{id:"mcepastebin",contentEditable:true,"data-mce-bogus":"all",style:"position: absolute; top: "+O+"px;width: 10px; height: 10px; overflow: hidden; opacity: 0"},r);if(i.ie||i.gecko){K.setStyle(o,"left",K.getStyle(L,"direction",true)=="rtl"?65535:-65535)}K.bind(o,"beforedeactivate focusin focusout",function(R){R.stopPropagation()});o.focus();q.selection.select(o,true)}function H(){if(o){var I;while((I=q.dom.get("mcepastebin"))){q.dom.remove(I);q.dom.unbind(I)}if(D){q.selection.setRng(D)}}o=D=null}function G(){var L="",J,K,M,I;J=q.dom.select("div[id=mcepastebin]");for(K=0;K<J.length;K++){M=J[K];if(M.firstChild&&M.firstChild.id=="mcepastebin"){M=M.firstChild}I=M.innerHTML;if(L!=r){L+=I}}return L}function v(K){var J={};if(K){if(K.getData){var M=K.getData("Text");if(M&&M.length>0){if(M.indexOf(s)==-1){J["text/plain"]=M}}}if(K.types){for(var I=0;I<K.types.length;I++){var L=K.types[I];J[L]=K.getData(L)}}}return J}function w(I){return v(I.clipboardData||q.getDoc().dataTransfer)}function u(L,J){var K=L.clipboardData||L.dataTransfer;function I(N){var P,Q,M,R=false;function O(S){if(J){q.selection.setRng(J);J=null}A('<img src="'+S.result+'">')}if(N){for(P=0;P<N.length;P++){Q=N[P];if(/^image\/(jpeg|png|gif|bmp)$/.test(Q.type)){M=new FileReader();M.onload=O.bind(null,M);M.readAsDataURL(Q.getAsFile?Q.getAsFile():Q);L.preventDefault();R=true}}}return R}if(q.settings.paste_data_images&&K){return I(K.items)||I(K.files)}}function z(I){var J=I.clipboardData;return navigator.userAgent.indexOf("Android")!=-1&&J&&J.items&&J.items.length===0}function m(I){return j.getCaretRangeFromPoint(I.clientX,I.clientY,q.getDoc())}function x(I,J){return J in I&&I[J].length>0}function F(I){return(l.metaKeyPressed(I)&&I.keyCode==86)||(I.shiftKey&&I.keyCode==45)}function p(){q.on("keydown",function(I){function J(K){if(F(K)&&!K.isDefaultPrevented()){H()}}if(F(I)&&!I.isDefaultPrevented()){E=I.shiftKey&&I.keyCode==86;if(E&&i.webkit&&navigator.userAgent.indexOf("Version/")!=-1){return}I.stopImmediatePropagation();n=new Date().getTime();if(i.ie&&E){I.preventDefault();q.fire("paste",{ieFake:true});return}H();t();q.once("keyup",J);q.once("paste",function(){q.off("keyup",J)})}});q.on("paste",function(M){var N=new Date().getTime();var L=w(M);var J=new Date().getTime()-N;var I=(new Date().getTime()-n-J)<1000;var K=y.pasteFormat=="text"||E;E=false;if(M.isDefaultPrevented()||z(M)){H();return}if(u(M)){H();return}if(!I){M.preventDefault()}if(i.ie&&(!I||M.ieFake)){t();q.dom.bind(o,"paste",function(O){O.stopPropagation()});q.getDoc().execCommand("Paste",false,null);L["text/html"]=G()}setTimeout(function(){var O;if(x(L,"text/html")){O=L["text/html"]}else{O=G();if(O==r){K=true}}O=k.trimHtml(O);if(o&&o.firstChild&&o.firstChild.id==="mcepastebin"){K=true}H();if(!O.length){K=true}if(K){if(x(L,"text/plain")&&O.indexOf("</p>")==-1){O=L["text/plain"]}else{O=k.innerText(O)}}if(O==r){if(!I){q.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")}return}if(K){B(O)}else{A(O)}},0)});q.on("dragstart dragend",function(I){C=I.type=="dragstart"});q.on("drop",function(L){var I=m(L);if(L.isDefaultPrevented()||C){return}if(u(L,I)){return}if(I&&q.settings.paste_filter_drop!==false){var J=v(L.dataTransfer);var K=J["mce-internal"]||J["text/html"]||J["text/plain"];if(K){L.preventDefault();q.undoManager.transact(function(){if(J["mce-internal"]){q.execCommand("Delete")}q.selection.setRng(I);K=k.trimHtml(K);if(!J["text/html"]){B(K)}else{A(K)}})}}});q.on("dragover dragend",function(I){if(q.settings.paste_data_images){I.preventDefault()}})}y.pasteHtml=A;y.pasteText=B;q.on("preInit",function(){p();q.parser.addNodeFilter("img",function(I){if(!q.settings.paste_data_images){var J=I.length;while(J--){var K=I[J].attributes.map.src;if(K&&/^(data:image|webkit\-fake\-url)/.test(K)){if(!I[J].attr("data-mce-object")&&K!==i.transparentSrc){I[J].remove()}}}}})})}});h("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(i,r,l,n,m,k){function q(s){return((/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i).test(s)||(/class="OutlineElement/).test(s)||(/id="?docs\-internal\-guid\-/.test(s)))}function j(u){var t,s;s=[/^[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]/];u=u.replace(/^[\u00a0 ]+/,"");i.each(s,function(v){if(v.test(u)){t=true;return false}});return t}function o(s){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(s)}function p(t){var s=t.settings;t.on("BeforePastePreProcess",function(A){var C=A.content,B,x;C=C.replace(/<b[^>]+id="?docs-internal-[^>]*>/gi,"");C=C.replace(/<br class="?Apple-interchange-newline"?>/gi,"");B=s.paste_retain_style_properties;if(B){x=i.makeMap(B.split(/[, ]/))}function z(K){var H,Q,F=1;function P(T){var S="";if(T.type===3){return T.value}if((T=T.firstChild)){do{S+=P(T)}while((T=T.next))}return S}function N(T,S){if(T.type===3){if(S.test(T.value)){T.value=T.value.replace(S,"");return false}}if((T=T.firstChild)){do{if(!N(T,S)){return false}}while((T=T.next))}return true}function J(S){if(S._listIgnore){S.remove();return}if((S=S.firstChild)){do{J(S)}while((S=S.next))}}function R(S,T,V){var U=S._listLevel||F;if(U!=F){if(U<F){if(H){H=H.parent.parent}}else{Q=H;H=null}}if(!H||H.name!=T){Q=Q||H;H=new m(T,1);if(V>1){H.attr("start",""+V)}S.wrap(H)}else{H.append(S)}S.name="li";if(U>F&&Q){Q.lastChild.append(H)}F=U;J(S);N(S,/^\u00a0+/);N(S,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);N(S,/^\u00a0+/)}var E=[],I=K.firstChild;while(typeof I!=="undefined"&&I!==null){E.push(I);I=I.walk();if(I!==null){while(typeof I!=="undefined"&&I.parent!==K){I=I.walk()}}}for(var L=0;L<E.length;L++){K=E[L];if(K.name=="p"&&K.firstChild){var O=P(K);if(o(O)){R(K,"ul");continue}if(j(O)){var M=/([0-9]+)\./.exec(O);var G=1;if(M){G=parseInt(M[1],10)}R(K,"ol",G);continue}if(K._listLevel){R(K,"ul",1);continue}H=null}else{Q=H;H=null}}}function u(G,E){var I={},H,F=t.dom.parseStyle(E);i.each(F,function(K,J){switch(J){case"mso-list":H=/\w+ \w+([0-9]+)/i.exec(E);if(H){G._listLevel=parseInt(H[1],10)}if(/Ignore/i.test(K)&&G.firstChild){G._listIgnore=true;G.firstChild._listIgnore=true}break;case"horiz-align":J="text-align";break;case"vert-align":J="vertical-align";break;case"font-color":case"mso-foreground":J="color";break;case"mso-background":case"mso-highlight":J="background";break;case"font-weight":case"font-style":if(K!="normal"){I[J]=K}return;case"mso-element":if(/^(comment|comment-list)$/i.test(K)){G.remove();return}break}if(J.indexOf("mso-comment")===0){G.remove();return}if(J.indexOf("mso-")===0){return}if(B=="all"||(x&&x[J])){I[J]=K}});if(/(bold)/i.test(I["font-weight"])){delete I["font-weight"];G.wrap(new m("b",1))}if(/(italic)/i.test(I["font-style"])){delete I["font-style"];G.wrap(new m("i",1))}I=t.dom.serializeStyle(I,G.name);if(I){return I}return null}if(s.paste_enable_default_filters===false){return}if(q(A.content)){A.wordContent=true;C=k.filter(C,[/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(F,E){return(E.length>0)?E.replace(/./," ").slice(Math.floor(E.length/2)).split("").join("\u00a0"):""}]]);var v=s.paste_word_valid_elements;if(!v){v=("-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")}var y=new l({valid_elements:v,valid_children:"-li[p]"});i.each(y.elements,function(E){if(!E.attributes["class"]){E.attributes["class"]={};E.attributesOrder.push("class")}if(!E.attributes.style){E.attributes.style={};E.attributesOrder.push("style")}});var D=new r({},y);D.addAttributeFilter("style",function(E){var F=E.length,G;while(F--){G=E[F];G.attr("style",u(G,G.attr("style")));if(G.name=="span"&&G.parent&&!G.attributes.length){G.unwrap()}}});D.addAttributeFilter("class",function(E){var F=E.length,H,G;while(F--){H=E[F];G=H.attr("class");if(/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(G)){H.remove()}H.attr("class",null)}});D.addNodeFilter("del",function(E){var F=E.length;while(F--){E[F].remove()}});D.addNodeFilter("a",function(F){var H=F.length,I,E,G;while(H--){I=F[H];E=I.attr("href");G=I.attr("name");if(E&&E.indexOf("#_msocom_")!=-1){I.remove();continue}if(E&&E.indexOf("file://")===0){E=E.split("#")[1];if(E){E="#"+E}}if(!E&&!G){I.unwrap()}else{if(G&&!/^_?(?:toc|edn|ftn)/i.test(G)){I.unwrap();continue}I.attr({href:E,name:G})}}});var w=D.parse(C);if(s.paste_convert_word_fake_lists!==false){z(w)}A.content=new n({},y).serialize(w)}})}p.isWordContent=q;return p});h("tinymce/pasteplugin/Quirks",["tinymce/Env","tinymce/util/Tools","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Utils"],function(i,j,l,k){return function(o){function p(q){o.on("BeforePastePreProcess",function(r){r.content=q(r.content)})}function n(q){if(!l.isWordContent(q)){return q}var r=[];j.each(o.schema.getBlockElements(),function(u,t){r.push(t)});var s=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+r.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");q=k.filter(q,[[s,"$1"]]);q=k.filter(q,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]]);return q}function m(s){if(l.isWordContent(s)){return s}var q=o.settings.paste_webkit_styles;if(o.settings.paste_remove_styles_if_webkit===false||q=="all"){return s}if(q){q=q.split(/[, ]/)}if(q){var t=o.dom,r=o.selection.getNode();s=s.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(B,z,A,u){var v=t.parseStyle(A,"span"),y={};if(q==="none"){return z+u}for(var x=0;x<q.length;x++){var w=v[q[x]],C=t.getStyle(r,q[x],true);if(/color/.test(q[x])){w=t.toHex(w);C=t.toHex(C)}if(C!=w){y[q[x]]=w}}y=t.serializeStyle(y,"span");if(y){return z+' style="'+y+'"'+u}return z+u})}else{s=s.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3")}s=s.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(u,w,v,x){return w+' style="'+v+'"'+x});return s}if(i.webkit){p(m)}if(i.ie){p(n)}}});h("tinymce/pasteplugin/Plugin",["tinymce/PluginManager","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks"],function(i,m,l,j){var k;i.add("paste",function(q){var o=this,r,p=q.settings;function n(){if(r.pasteFormat=="text"){this.active(false);r.pasteFormat="html"}else{r.pasteFormat="text";this.active(true);if(!k){q.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.");k=true}}}o.clipboard=r=new m(q);o.quirks=new j(q);o.wordFilter=new l(q);if(q.settings.paste_as_text){o.clipboard.pasteFormat="text"}if(p.paste_preprocess){q.on("PastePreProcess",function(s){p.paste_preprocess.call(o,o,s)})}if(p.paste_postprocess){q.on("PastePostProcess",function(s){p.paste_postprocess.call(o,o,s)})}q.addCommand("mceInsertClipboardContent",function(t,s){if(s.content){o.clipboard.pasteHtml(s.content)}if(s.text){o.clipboard.pasteText(s.text)}});if(q.paste_block_drop){q.on("dragend dragover draggesture dragdrop drop drag",function(s){s.preventDefault();s.stopPropagation()})}if(!q.settings.paste_data_images){q.on("drop",function(t){var s=t.dataTransfer;if(s&&s.files&&s.files.length>0){t.preventDefault()}})}q.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:n,active:o.clipboard.pasteFormat=="text"});q.addMenuItem("pastetext",{text:"Paste as text",selectable:true,active:r.pasteFormat,onclick:n})})});a(["tinymce/pasteplugin/Utils"])})(this);
\ No newline at end of file