Files
Testing/html5-chat1/chatadmin/editors/tinymce/plugins/paste/plugin.min.min.js

1 line
8.2 KiB
JavaScript
Raw Normal View History

2026-11-17 16:15:01 -05:00
!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,