]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/paste/editor_plugin.js
Wordpress 2.8.3-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / paste / editor_plugin.js
index 5e884cffa280e09c268362fa8ce48610888bdffc..e0e51b5b17bd62d200b7d259da564a5e837147e9 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 a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var k=c.dom,j={content:i};e.onPreProcess.dispatch(e,j);j.node=k.create("div",0,j.content);e.onPostProcess.dispatch(e,j);j.content=c.serializer.serialize(j.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(j.content)){e._insertBlockContent(c,k,j.content)}else{e._insert(j.content)}}c.addCommand("mceInsertClipboardContent",function(i,h){g(h)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"&nbsp;");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);g(p.innerHTML);return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var r=o.get("_mcePaste"),q;r.id="_mceRemoved";o.remove(r);r=o.get("_mcePaste")||r;q=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML;o.remove(r);if(k){j.setRng(k)}g(q)},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._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(d,g){var b=this.editor,c=g.content,f,e;function f(h){a(h,function(i){if(i.constructor==RegExp){c=c.replace(i,"")}else{c=c.replace(i[0],i[1])}})}f([/^\s*(&nbsp;)+/g,/(&nbsp;|<br[^>]*>)+\s*$/g]);if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)){g.wordContent=true;if(b.getParam("paste_convert_middot_lists",true)){f([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<span[^>]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}f([/<!--[\s\S]+?-->/gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/<script[^>]+>[\s\S]*?<\/script>/gi,[/&nbsp;/g,"\u00a0"]]);if(!b.getParam("paste_retain_style_properties")){f([/<\/?(span)[^>]*>/gi])}}e=b.getParam("paste_strip_class_attributes","all");if(e!="none"){if(e=="all"){f([/ class=\"([^\"]*)\"/gi,/ class=(\w+)/gi])}else{f([/ class=\"(mso[^\"]*)\"/gi,/ class=(mso\w+)/gi])}}if(b.getParam("paste_remove_spans")){f([/<\/?(span)[^>]*>/gi])}g.content=c},_postProcess:function(e,g){var d=this,c=d.editor,f=c.dom,b;if(g.wordContent){a(f.select("a",g.node),function(h){if(!h.href||h.href.indexOf("#_Toc")!=-1){f.remove(h,1)}});if(d.editor.getParam("paste_convert_middot_lists",true)){d._convertLists(e,g)}b=c.getParam("paste_retain_style_properties");if(tinymce.is(b,"string")){b=tinymce.explode(b)}a(f.select("*",g.node),function(l){var m={},j=0,k,n,h;if(b){for(k=0;k<b.length;k++){n=b[k];h=f.getStyle(l,n);if(h){m[n]=h;j++}}}f.setAttrib(l,"style","");if(b&&j>0){f.setStyles(l,m)}else{if(l.nodeName=="SPAN"&&!l.className){f.remove(l,true)}}})}if(c.getParam("paste_remove_styles")||(c.getParam("paste_remove_styles_if_webkit")&&tinymce.isWebKit)){a(f.select("*[style]",g.node),function(h){h.removeAttribute("style");h.removeAttribute("mce_style")})}else{if(tinymce.isWebKit){a(f.select("*",g.node),function(h){h.removeAttribute("mce_style")})}}},_convertLists:function(e,c){var g=e.editor.dom,f,j,b=-1,d,k=[],i,h;a(g.select("p",c.node),function(r){var n,s="",q,o,l,m;for(n=r.firstChild;n&&n.nodeType==3;n=n.nextSibling){s+=n.nodeValue}s=r.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o]\s*\u00a0*/.test(s)){q="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0{2,}/.test(s)){q="ol"}if(q){d=parseFloat(r.style.marginLeft||0);if(d>b){k.push(d)}if(!f||q!=i){f=g.create(q);g.insertAfter(f,r)}else{if(d>b){f=j.appendChild(g.create(q))}else{if(d<b){l=tinymce.inArray(k,d);m=g.getParents(f.parentNode,q);f=m[m.length-1-l]||f}}}a(g.select("span",r),function(t){var p=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(q=="ul"&&/^[\u2022\u00b7\u00a7\u00d8o]/.test(p)){g.remove(t)}else{if(/^[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){g.remove(t)}}});o=r.innerHTML;if(q=="ul"){o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o]\s*(&nbsp;|\u00a0)+\s*/,"")}else{o=r.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}j=f.appendChild(g.create("li",0,o));g.remove(r);b=d;i=q}else{f=b=0}});h=c.node.innerHTML;if(h.indexOf("__MCE_ITEM__")!=-1){c.node.innerHTML=h.replace(/__MCE_ITEM__/g,"")}},_insertBlockContent:function(h,e,i){var c,g,d=h.selection,m,j,b,k,f;function l(p){var o;if(tinymce.isIE){o=h.getDoc().body.createTextRange();o.moveToElementText(p);o.collapse(false);o.select()}else{d.select(p,1);d.collapse(false)}}this._insert('<span id="_marker">&nbsp;</span>',1);g=e.get("_marker");c=e.getParent(g,"p,h1,h2,h3,h4,h5,h6,ul,ol");if(c){g=e.split(c,g);a(e.create("div",0,i).childNodes,function(o){m=g.parentNode.insertBefore(o.cloneNode(true),g)});l(m)}else{e.setOuterHTML(g,i);d.select(h.getBody(),1);d.collapse(0)}e.remove("_marker");j=d.getStart();b=e.getViewPort(h.getWin());k=h.dom.getPos(j).y;f=j.clientHeight;if(k<b.y||k+f>b.y+b.h){h.getDoc().body.scrollTop=k<b.y?k:k-b.h+25}},_insert:function(d,b){var c=this.editor;if(!c.selection.isCollapsed()){c.getDoc().execCommand("Delete",false,null)}c.execCommand(tinymce.isGecko?"insertHTML":"mceInsertContent",false,d,{skip_undo:b})},_legacySupport:function(){var c=this,b=c.editor;a(["mcePasteText","mcePasteWord"],function(d){b.addCommand(d,function(){b.windowManager.open({file:c.url+(d=="mcePasteText"?"/pastetext.htm":"/pasteword.htm"),width:parseInt(b.getParam("paste_dialog_width","450")),height:parseInt(b.getParam("paste_dialog_height","400")),inline:1})})});b.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});b.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"});b.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file