Files
Testing/html5-chat/chatadmin/editors/tinymce/plugins/paste/plugin.min.min.min.js
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

1 line
8.2 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(J,w){function C(d,b){for(var f,c=[],a=0;a<d.length;++a){if(f=x[d[a]]||B(d[a]),!f){throw"module definition dependecy not found: "+d[a]}c.push(f)}b.apply(null,c)}function z(c,b,a){if("string"!=typeof c){throw"invalid module definition, module id must be defined and be a string"}if(b===w){throw"invalid module definition, dependencies must be specified"}if(a===w){throw"invalid module definition, definition function must be specified"}C(b,function(){x[c]=a.apply(null,arguments)})}function F(a){return!!x[a]}function B(b){for(var d=J,c=b.split(/[.\/]/),a=0;a<c.length;++a){if(!d[c[a]]){return}d=d[c[a]]}return d}function N(g){for(var e=0;e<g.length;e++){for(var d=J,f=g[e],c=f.split(/[.\/]/),b=0;b<c.length-1;++b){d[c[b]]===w&&(d[c[b]]={}),d=d[c[b]]}d[c[c.length-1]]=x[f]}}var x={},E="tinymce/pasteplugin/Clipboard",L="tinymce/Env",K="tinymce/util/Tools",q="tinymce/util/VK",I="tinymce/pasteplugin/WordFilter",A="tinymce/html/DomParser",D="tinymce/html/Schema",G="tinymce/html/Serializer",H="tinymce/html/Node",k="tinymce/pasteplugin/Quirks",j="tinymce/pasteplugin/Plugin",M="tinymce/PluginManager";z(E,[L,K,q],function(c,a,d){function b(){return!c.gecko&&("ClipboardEvent"in window||c.webkit&&"FocusEvent"in window)}return function(t){function g(){return(new Date).getTime()}function Q(f){return d.metaKeyPressed(f)&&86==f.keyCode||f.shiftKey&&45==f.keyCode}function S(f){return f.innerText||f.textContent}function r(){return g()-v<100||"text"==n.pasteFormat}function P(f,h){return a.each(h,function(i){f=i.constructor==RegExp?f.replace(i,""):f.replace(i[0],i[1])}),f}function O(f){var h=t.fire("PastePreProcess",{content:f});f=h.content,t.settings.paste_data_images||(f=f.replace(/<img src=\"data:image[^>]+>/g,"")),(t.settings.paste_remove_styles||t.settings.paste_remove_styles_if_webkit!==!1&&c.webkit)&&(f=f.replace(/ style=\"[^\"]+\"/g,"")),h.isDefaultPrevented()||t.insertContent(f)}function R(h){h=t.dom.encode(h).replace(/\r\n/g,"\n");var f=t.dom.getParent(t.selection.getStart(),t.dom.isBlock);h=f&&/^(PRE|DIV)$/.test(f.nodeName)||!t.settings.forced_root_block?P(h,[[/\n/g,"<br>"]]):P(h,[[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]]);var i=t.fire("PastePreProcess",{content:h});i.isDefaultPrevented()||t.insertContent(i.content)}function y(){var h=t.dom.getViewPort().y,f=t.dom.add(t.getBody(),"div",{contentEditable:!1,"data-mce-bogus":"1",style:"position: absolute; top: "+h+"px; left: 0; width: 1px; height: 1px; overflow: hidden"},'<div contentEditable="true" data-mce-bogus="1">X</div>');return t.dom.bind(f,"beforedeactivate focusin focusout",function(i){i.stopPropagation()}),f}function e(f){t.dom.unbind(f),t.dom.remove(f)}var n=this,v;t.on("keydown",function(f){d.metaKeyPressed(f)&&f.shiftKey&&86==f.keyCode&&(v=g())}),b()?t.on("paste",function(h){function f(o,l){for(var m=0;m<i.types.length;m++){if(i.types[m]==o){return l(i.getData(o)),!0}}}var i=h.clipboardData;i&&(h.preventDefault(),r()?f("text/plain",R)||f("text/html",O):f("text/html",O)||f("text/plain",R))}):(c.ie?t.on("init",function(){var h=t.dom,f=0;t.on("keydown",function(m){if(Q(m)&&!m.isDefaultPrevented()){var i=y();f=g(),h.bind(i,"paste",function(){setTimeout(function(){e(i),t.selection.setRng(l),r()?R(S(i.firstChild)):O(i.firstChild.innerHTML)},0)});var l=t.selection.getRng();i.firstChild.focus(),i.firstChild.innerText=""}}),t.dom.bind(t.getBody(),"paste",function(s){if(g()-f>100){var o,l=y();s.preventDefault(),h.bind(l,"paste",function(m){m.stopPropagation(),o=!0});var p=t.selection.getRng(),i=h.doc.body.createTextRange();if(i.moveToElementText(l.firstChild),i.execCommand("Paste"),e(l),!o){return t.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."),void 0}t.selection.setRng(p),r()?R(S(l.firstChild)):O(l.firstChild.innerHTML)}})}):(t.on("init",function(){t.dom.bind(t.getBody(),"paste",function(f){f.preventDefault(),t.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")})}),t.on("keydown",function(h){if(Q(h)&&!h.isDefaultPrevented()){var f=y(),i=t.selection.getRng();t.selection.select(f,!0),t.dom.bind(f,"paste",function(l){l.stopPropagation(),setTimeout(function(){e(f),t.lastRng=i,t.selection.setRng(i);var m=f.firstChild;m.lastChild&&"BR"==m.lastChild.nodeName&&m.removeChild(m.lastChild),r()?R(S(m)):O(m.innerHTML)},0)})}})),t.settings.paste_data_images||t.on("drop",function(h){var f=h.dataTransfer;f&&f.files&&f.files.length>0&&h.preventDefault()})),t.paste_block_drop&&t.on("dragend dragover draggesture dragdrop drop drag",function(f){f.preventDefault(),f.stopPropagation()}),this.paste=O,this.pasteText=R}}),z(I,[K,A,D,G,H],function(d,b,f,c,a){return function(g){var e=d.each;g.on("PastePreProcess",function(Q){function o(h){e(h,function(l){P=l.constructor==RegExp?P.replace(l,""):P.replace(l[0],l[1])})}function O(S){function X(ac,aa,Z,ab){var u=ac._listLevel||m;u!=m&&(m>u?p&&(p=p.parent.parent):(h=p,p=null)),p&&p.name==Z?p.append(ac):(h=h||p,p=new a(Z,1),ab>1&&p.attr("start",""+ab),ac.wrap(p)),ac.name="li",aa.value="";var ad=aa.next;ad&&3==ad.type&&(ad.value=ad.value.replace(/^\u00a0+/,"")),u>m&&h.lastChild.append(p),m=u}for(var p,h,m=1,V=S.getAll("p"),Y=0;Y<V.length;Y++){if(S=V[Y],"p"==S.name&&S.firstChild){for(var R="",U=S.firstChild;U&&!(R=U.value);){U=U.firstChild}if(/^\s*[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*$/.test(R)){X(S,U,"ul");continue}if(/^\s*\w+\./.test(R)){var T=/([0-9])\./.exec(R),W=1;T&&(W=parseInt(T[1],10)),X(S,U,"ol",W);continue}p=null}}}function y(l,p){if("p"===l.name){var m=/mso-list:\w+ \w+([0-9]+)/.exec(p);m&&(l._listLevel=parseInt(m[1],10))}if(g.getParam("paste_retain_style_properties","none")){var h="";if(d.each(g.dom.parseStyle(p),function(u,s){switch(s){case"horiz-align":return s="text-align",void 0;case"vert-align":return s="vertical-align",void 0;case"font-color":case"mso-foreground":return s="color",void 0;case"mso-background":case"mso-highlight":s="background"}("all"==v||i&&i[s])&&(h+=s+":"+u+";")}),h){return h}}return null}var P=Q.content,v,i;if(v=g.settings.paste_retain_style_properties,v&&(i=d.makeMap(v)),g.settings.paste_enable_default_filters!==!1&&/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(Q.content)){Q.wordContent=!0,o([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi," "],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(l,h){return h.length>0?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join(" "):""}]]);var n=new f({valid_elements:"@[style],-strong/b,-em/i,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[!href]"}),r=new b({},n);r.addAttributeFilter("style",function(l){for(var h=l.length,m;h--;){m=l[h],m.attr("style",y(m,m.attr("style"))),"span"!=m.name||m.attributes.length||m.unwrap()}});var t=r.parse(P);O(t),Q.content=new c({},n).serialize(t)}})}}),z(k,[L,K],function(b,a){return function(h){function f(i){h.on("PastePreProcess",function(l){l.content=i(l.content)})}function d(i,l){return a.each(l,function(m){i=m.constructor==RegExp?i.replace(m,""):i.replace(m[0],m[1])}),i}function g(i){return i=d(i,[/^[\s\S]*<!--StartFragment-->|<!--EndFragment-->[\s\S]*$/g,[/<span class="Apple-converted-space">\u00a0<\/span>/g," "],/<br>$/])}function c(l){if(!e){var i=[];a.each(h.schema.getBlockElements(),function(n,m){i.push(m)}),e=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+i.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g")}return l=d(l,[[e,"$1"]]),l=d(l,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}var e;b.webkit&&f(g),b.ie&&f(c)}}),z(j,[M,E,I,k],function(d,b,f,c){var a;d.add("paste",function(h){var i=this,g;i.clipboard=g=new b(h),i.quirks=new c(h),i.wordFilter=new f(h),h.settings.paste_as_text&&(i.clipboard.pasteFormat="text"),h.addCommand("mceInsertClipboardContent",function(m,l){l.content&&i.clipboard.paste(l.content),l.text&&i.clipboard.pasteText(l.text)}),h.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:g.pasteFormat,onclick:function(){"text"==g.pasteFormat?(this.active(!1),g.pasteFormat="html"):(g.pasteFormat="text",this.active(!0),a||(h.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),a=!0))}})})}),N([E,I,k,j])}(this);