]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/paste/editor_plugin.js
WordPress 3.8.3-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / paste / editor_plugin.js
index 5e884cffa280e09c268362fa8ce48610888bdffc..0ab05ebbb62733c04a1a4b98838f35b2dbdf00b1 100644 (file)
@@ -1,395 +1 @@
-/**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
- */
-
-/* Import plugin specific language pack */ 
-tinyMCE.importPluginLanguagePack('paste');
-
-var TinyMCE_PastePlugin = {
-       getInfo : function() {
-               return {
-                       longname : 'Paste text/word',
-                       author : 'Moxiecode Systems AB',
-                       authorurl : 'http://tinymce.moxiecode.com',
-                       infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
-                       version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-               };
-       },
-
-       initInstance : function(inst) {
-               if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
-                       tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
-       },
-
-       handleEvent : function(e) {
-               // Force paste dialog if non IE browser
-               if (!tinyMCE.isRealIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false) && e.ctrlKey && e.keyCode == 86 && e.type == "keydown") {
-                       window.setTimeout('tinyMCE.selectedInstance.execCommand("mcePasteText",true)', 1);
-                       return tinyMCE.cancelEvent(e);
-               }
-
-               return true;
-       },
-
-       getControlHTML : function(cn) { 
-               switch (cn) { 
-                       case "pastetext":
-                               return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
-
-                       case "pasteword":
-                               return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
-
-                       case "selectall":
-                               return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
-               } 
-
-               return ''; 
-       },
-
-       execCommand : function(editor_id, element, command, user_interface, value) { 
-               switch (command) { 
-                       case "mcePasteText": 
-                               if (user_interface) {
-                                       if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
-                                               TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true); 
-                                       else { 
-                                               var template = new Array(); 
-                                               template['file']        = '../../plugins/paste/pastetext.htm'; // Relative to theme 
-                                               template['width']  = 450; 
-                                               template['height'] = 400; 
-                                               var plain_text = ""; 
-                                               tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'}); 
-                                       }
-                               } else
-                                       TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
-
-                               return true;
-
-                       case "mcePasteWord": 
-                               if (user_interface) {
-                                       if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
-                                               TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
-                                       } else { 
-                                               var template = new Array(); 
-                                               template['file']        = '../../plugins/paste/pasteword.htm'; // Relative to theme 
-                                               template['width']  = 450; 
-                                               template['height'] = 400; 
-                                               var plain_text = ""; 
-                                               tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
-                                       }
-                               } else
-                                       TinyMCE_PastePlugin._insertWordContent(value);
-
-                               return true;
-
-                       case "mceSelectAll":
-                               tinyMCE.execInstanceCommand(editor_id, 'selectall'); 
-                               return true; 
-
-               } 
-
-               // Pass to next handler in chain 
-               return false; 
-       },
-
-       // Private plugin internal methods
-
-       _handlePasteEvent : function(e) {
-               switch (e.type) {
-                       case "paste":
-                               var html = TinyMCE_PastePlugin._clipboardHTML();
-                               var r, inst = tinyMCE.selectedInstance;
-
-                               // Removes italic, strong etc, the if was needed due to bug #1437114
-                               if (inst && (r = inst.getRng()) && r.text.length > 0)
-                                       tinyMCE.execCommand('delete');
-
-                               if (html && html.length > 0)
-                                       tinyMCE.execCommand('mcePasteWord', false, html);
-
-                               tinyMCE.cancelEvent(e);
-                               return false;
-               }
-
-               return true;
-       },
-
-       _insertText : function(content, bLinebreaks) { 
-               if (content && content.length > 0) {
-                       if (bLinebreaks) { 
-                               // Special paragraph treatment 
-                               if (tinyMCE.getParam("paste_create_paragraphs", true)) {
-                                       var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
-                                       for (var i=0; i<rl.length; i+=2)
-                                               content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
-
-                                       content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi"); 
-                                       content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi"); 
-                                       content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi"); 
-
-                                       // Has paragraphs 
-                                       if ((pos = content.indexOf('</p><p>')) != -1) { 
-                                               tinyMCE.execCommand("Delete"); 
-
-                                               var node = tinyMCE.selectedInstance.getFocusElement(); 
-
-                                               // Get list of elements to break 
-                                               var breakElms = new Array(); 
-
-                                               do { 
-                                                       if (node.nodeType == 1) { 
-                                                               // Don't break tables and break at body 
-                                                               if (node.nodeName == "TD" || node.nodeName == "BODY") 
-                                                                       break; 
-               
-                                                               breakElms[breakElms.length] = node; 
-                                                       } 
-                                               } while(node = node.parentNode); 
-
-                                               var before = "", after = "</p>"; 
-                                               before += content.substring(0, pos); 
-
-                                               for (var i=0; i<breakElms.length; i++) { 
-                                                       before += "</" + breakElms[i].nodeName + ">"; 
-                                                       after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; 
-                                               } 
-
-                                               before += "<p>"; 
-                                               content = before + content.substring(pos+7) + after; 
-                                       } 
-                               } 
-
-                               if (tinyMCE.getParam("paste_create_linebreaks", true)) {
-                                       content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi"); 
-                                       content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi"); 
-                                       content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi"); 
-                               }
-                       } 
-               
-                       tinyMCE.execCommand("mceInsertRawHTML", false, content); 
-               }
-       },
-
-       _insertWordContent : function(content) { 
-               if (content && content.length > 0) {
-                       // Cleanup Word content
-                       var bull = String.fromCharCode(8226);
-                       var middot = String.fromCharCode(183);
-                       var cb;
-
-                       if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
-                               content = eval(cb + "('before', content)");
-
-                       var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
-                       for (var i=0; i<rl.length; i+=2)
-                               content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
-
-                       if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
-                               content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
-                       }
-
-                       content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
-                       content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
-                       content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
-                       content = content.replace(/<o:p><\/o:p>/gi, "");
-                       content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
-                       content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), "");  // Word comments
-
-                       if (tinyMCE.getParam("paste_remove_spans", true))
-                               content = content.replace(/<\/?span[^>]*>/gi, "");
-
-                       if (tinyMCE.getParam("paste_remove_styles", true))
-                               content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
-
-                       content = content.replace(/<\/?font[^>]*>/gi, "");
-
-                       // Strips class attributes.
-                       switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
-                               case "all":
-                                       content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
-                                       break;
-
-                               case "mso":
-                                       content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
-                                       break;
-                       }
-
-                       content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
-                       content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
-                       content = content.replace(/<\\?\?xml[^>]*>/gi, "");
-                       content = content.replace(/<\/?\w+:[^>]*>/gi, "");
-                       content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks
-                       content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
-
-       //              content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp;
-       //              content = content.replace(/<p>&nbsp;<\/p>/gi, '');
-
-                       if (!tinyMCE.settings['force_p_newlines']) {
-                               content = content.replace('', '' ,'gi');
-                               content = content.replace('</p>', '<br /><br />' ,'gi');
-                       }
-
-                       if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
-                               content = content.replace(/<\/?p[^>]*>/gi, "");
-                       }
-
-                       content = content.replace(/<\/?div[^>]*>/gi, "");
-
-                       // Convert all middlot lists to UL lists
-                       if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
-                               var div = document.createElement("div");
-                               div.innerHTML = content;
-
-                               // Convert all middot paragraphs to li elements
-                               var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
-
-                               while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
-                               while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
-                               while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
-
-                               content = div.innerHTML;
-                       }
-
-                       // Replace all headers with strong and fix some other issues
-                       if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
-                               content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>');
-                               content = content.replace(/<h[1-6]>/gi, '<p><b>');
-                               content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
-                               content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>');
-                               content = content.replace(/^(&nbsp;)*/gi, '');
-                       }
-
-                       content = content.replace(/--list--/gi, ""); // Remove --list--
-
-                       if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
-                               content = eval(cb + "('after', content)");
-
-                       // Insert cleaned content
-                       tinyMCE.execCommand("mceInsertContent", false, content);
-
-                       if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
-                               window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
-               }
-       },
-
-       _reEscape : function(s) {
-               var l = "?.\\*[](){}+^$:";
-               var o = "";
-
-               for (var i=0; i<s.length; i++) {
-                       var c = s.charAt(i);
-
-                       if (l.indexOf(c) != -1)
-                               o += '\\' + c;
-                       else
-                               o += c;
-               }
-
-               return o;
-       },
-
-       _convertMiddots : function(div, search, class_name) {
-               var mdot = String.fromCharCode(183);
-               var bull = String.fromCharCode(8226);
-
-               var nodes = div.getElementsByTagName("p");
-               var prevul;
-               for (var i=0; i<nodes.length; i++) {
-                       var p = nodes[i];
-
-                       // Is middot
-                       if (p.innerHTML.indexOf(search) == 0) {
-                               var ul = document.createElement("ul");
-
-                               if (class_name)
-                                       ul.className = class_name;
-
-                               // Add the first one
-                               var li = document.createElement("li");
-                               li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
-                               ul.appendChild(li);
-
-                               // Add the rest
-                               var np = p.nextSibling;
-                               while (np) {
-                               // If the node is whitespace, then
-                               // ignore it and continue on.
-                               if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
-                                       np = np.nextSibling;
-                                       continue;
-                               }
-
-                                       if (search == mdot) {
-                                               if (np.nodeType == 1 && new RegExp('^o(\\s+|&nbsp;)').test(np.innerHTML)) {
-                                                       // Second level of nesting
-                                                       if (!prevul) {
-                                                               prevul = ul;
-                                                               ul = document.createElement("ul");
-                                                               prevul.appendChild(ul);
-                                                       }
-                                                       np.innerHTML = np.innerHTML.replace(/^o/, '');
-                                               } else {
-                                                       // Pop the stack if we're going back up to the first level
-                                                       if (prevul) {
-                                                               ul = prevul;
-                                                               prevul = null;
-                                                       }
-                                                       // Not element or middot paragraph
-                                                       if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
-                                                               break;
-                                               }
-                                       } else {
-                                               // Not element or middot paragraph
-                                               if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
-                                                       break;
-                                       }
-
-                                       var cp = np.nextSibling;
-                                       var li = document.createElement("li");
-                                       li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--|&nbsp;', "gi"), '');
-                                       np.parentNode.removeChild(np);
-                                       ul.appendChild(li);
-                                       np = cp;
-                               }
-
-                               p.parentNode.replaceChild(ul, p);
-
-                               return true;
-                       }
-               }
-
-               return false;
-       },
-
-       _clipboardHTML : function() {
-               var div = document.getElementById('_TinyMCE_clipboardHTML');
-
-               if (!div) {
-                       var div = document.createElement('DIV');
-                       div.id = '_TinyMCE_clipboardHTML';
-
-                       with (div.style) {
-                               visibility = 'hidden';
-                               overflow = 'hidden';
-                               position = 'absolute';
-                               width = 1;
-                               height = 1;
-                       }
-
-                       document.body.appendChild(div);
-               }
-
-               div.innerHTML = '';
-               var rng = document.body.createTextRange();
-               rng.moveToElementText(div);
-               rng.execCommand('Paste');
-               var html = div.innerHTML;
-               div.innerHTML = '';
-               return html;
-       }
-};
-
-tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
+(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_max_consecutive_linebreaks:2,paste_text_use_dialog:false,paste_text_sticky:false,paste_text_sticky_default:false,paste_text_notifyalways:false,paste_text_linebreaktype:"combined",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=b(d,"paste_text_sticky_default");function h(l,j){var k=d.dom,i;f.onPreProcess.dispatch(f,l);l.node=k.create("div",0,l.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){if(l.node.childNodes.length===1&&/^(p|h[1-6]|pre)$/i.test(l.node.firstChild.nodeName)&&l.content.indexOf("__MCE_ITEM__")===-1){k.remove(l.node.firstChild,true)}}}f.onPostProcess.dispatch(f,l);l.content=d.serializer.serialize(l.node,{getInner:1,forced_root_block:""});if((!j)&&(d.pasteAsPlainText)){f._insertPlainText(l.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(l.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:o.encode(r).replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},"\uFEFF\uFEFF");if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort(d.getWin()).y}o.setStyles(l,{position:"absolute",left:tinymce.isGecko?-40:0,top:i-25,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,2);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<p>"+o.encode(r).replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br />")+"</p>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}d.onInit.add(function(){d.controlManager.setActive("pastetext",d.pasteAsPlainText);if(b(d,"paste_block_drop")){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})}});f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9&&/<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(e.content)){d([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g,"$1"]]);d([[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/&quot;/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j){var h=this.editor,f=b(h,"paste_text_linebreaktype"),k=b(h,"paste_text_replacements"),g=tinymce.is;function e(m){c(m,function(n){if(n.constructor==RegExp){j=j.replace(n,"")}else{j=j.replace(n[0],n[1])}})}if((typeof(j)==="string")&&(j.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(j)){e([/[\n\r]+/g])}else{e([/\r+/g])}e([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"]]);var d=Number(b(h,"paste_max_consecutive_linebreaks"));if(d>-1){var l=new RegExp("\n{"+(d+1)+",}","g");var i="";while(i.length<d){i+="\n"}e([[l,i]])}j=h.dom.decode(tinymce.html.Entities.encodeRaw(j));if(g(k,"array")){e(k)}else{if(g(k,"string")){e(new RegExp(k,"gi"))}}if(f=="none"){e([[/\n+/g," "]])}else{if(f=="br"){e([[/\n/g,"<br />"]])}else{if(f=="p"){e([[/\n+/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"]])}else{e([[/\n\n/g,"</p><p>"],[/^(.*<\/p>)(<p>)$/,"<p>$1"],[/\n/g,"<br />"]])}}}h.execCommand("mceInsertContent",false,j)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file