<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16394] trunk:
  Remove invalid parent paragraph when pasting in the visual editor or switching visual to HTML and back
 , keep multiple empty lines in a &lt;pre&gt; tag, fixes #15095 fixes #15367</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16394">16394</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2010-11-15 23:57:27 +0000 (Mon, 15 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove invalid parent paragraph when pasting in the visual editor or switching visual to HTML and back, keep multiple empty lines in a &lt;pre&gt; tag, fixes <a href="http://trac.wordpress.org/ticket/15095">#15095</a> fixes <a href="http://trac.wordpress.org/ticket/15367">#15367</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjseditordevjs">trunk/wp-admin/js/editor.dev.js</a></li>
<li><a href="#trunkwpadminjseditorjs">trunk/wp-admin/js/editor.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswordpresseditor_plugindevjs">trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswordpresseditor_pluginjs">trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js</a></li>
<li><a href="#trunkwpincludesjstinymcewptinymcejsgz">trunk/wp-includes/js/tinymce/wp-tinymce.js.gz</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjseditordevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/editor.dev.js (16393 => 16394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/editor.dev.js        2010-11-15 23:48:24 UTC (rev 16393)
+++ trunk/wp-admin/js/editor.dev.js        2010-11-15 23:57:27 UTC (rev 16394)
</span><span class="lines">@@ -26,21 +26,23 @@
</span><span class="cx">                 var blocklist1, blocklist2;
</span><span class="cx"> 
</span><span class="cx">                 // Protect pre|script tags
</span><del>-                content = content.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
-                        a = a.replace(/&lt;br ?\/?&gt;[\r\n]*/g, '&lt;wp_temp&gt;');
-                        return a.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g, '&lt;wp_temp&gt;');
-                });
</del><ins>+                if ( content.indexOf('&lt;pre') != -1 || content.indexOf('&lt;script') != -1 ) {
+                        content = content.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
+                                a = a.replace(/&lt;br ?\/?&gt;(\r\n|\n)?/g, '&lt;wp_temp&gt;');
+                                return a.replace(/&lt;\/?p( [^&gt;]*)?&gt;(\r\n|\n)?/g, '&lt;wp_temp&gt;');
+                        });
+                }
</ins><span class="cx"> 
</span><span class="cx">                 // Pretty it up for the source editor
</span><span class="cx">                 blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset';
</span><span class="cx">                 content = content.replace(new RegExp('\\s*&lt;/('+blocklist1+')&gt;\\s*', 'g'), '&lt;/$1&gt;\n');
</span><del>-                content = content.replace(new RegExp('\\s*&lt;(('+blocklist1+')[^&gt;]*)&gt;', 'g'), '\n&lt;$1&gt;');
</del><ins>+                content = content.replace(new RegExp('\\s*&lt;((?:'+blocklist1+')(?: [^&gt;]*)?)&gt;', 'g'), '\n&lt;$1&gt;');
</ins><span class="cx"> 
</span><span class="cx">                 // Mark &lt;/p&gt; if it has any attributes.
</span><span class="cx">                 content = content.replace(/(&lt;p [^&gt;]+&gt;.*?)&lt;\/p&gt;/g, '$1&lt;/p#&gt;');
</span><span class="cx"> 
</span><span class="cx">                 // Sepatate &lt;div&gt; containing &lt;p&gt;
</span><del>-                content = content.replace(/&lt;div([^&gt;]*)&gt;\s*&lt;p&gt;/gi, '&lt;div$1&gt;\n\n');
</del><ins>+                content = content.replace(/&lt;div( [^&gt;]*)?&gt;\s*&lt;p&gt;/gi, '&lt;div$1&gt;\n\n');
</ins><span class="cx"> 
</span><span class="cx">                 // Remove &lt;p&gt; and &lt;br /&gt;
</span><span class="cx">                 content = content.replace(/\s*&lt;p&gt;/gi, '');
</span><span class="lines">@@ -55,10 +57,14 @@
</span><span class="cx">                 content = content.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption');
</span><span class="cx"> 
</span><span class="cx">                 blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset';
</span><del>-                content = content.replace(new RegExp('\\s*&lt;(('+blocklist2+') ?[^&gt;]*)\\s*&gt;', 'g'), '\n&lt;$1&gt;');
</del><ins>+                content = content.replace(new RegExp('\\s*&lt;((?:'+blocklist2+')(?: [^&gt;]*)?)\\s*&gt;', 'g'), '\n&lt;$1&gt;');
</ins><span class="cx">                 content = content.replace(new RegExp('\\s*&lt;/('+blocklist2+')&gt;\\s*', 'g'), '&lt;/$1&gt;\n');
</span><span class="cx">                 content = content.replace(/&lt;li([^&gt;]*)&gt;/g, '\t&lt;li$1&gt;');
</span><span class="cx"> 
</span><ins>+                if ( content.indexOf('&lt;hr') != -1 ) {
+                        content = content.replace(/\s*&lt;hr( [^&gt;]*)?&gt;\s*/g, '\n\n&lt;hr$1&gt;\n\n');
+                }
+
</ins><span class="cx">                 if ( content.indexOf('&lt;object') != -1 ) {
</span><span class="cx">                         content = content.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g, function(a){
</span><span class="cx">                                 return a.replace(/[\r\n]+/g, '');
</span><span class="lines">@@ -129,7 +135,7 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         _wp_Autop : function(pee) {
</span><del>-                var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend';
</del><ins>+                var blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr';
</ins><span class="cx"> 
</span><span class="cx">                 if ( pee.indexOf('&lt;object') != -1 ) {
</span><span class="cx">                         pee = pee.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g, function(a){
</span><span class="lines">@@ -141,37 +147,42 @@
</span><span class="cx">                         return a.replace(/[\r\n]+/g, ' ');
</span><span class="cx">                 });
</span><span class="cx"> 
</span><ins>+                // Protect pre|script tags
+                if ( pee.indexOf('&lt;pre') != -1 || pee.indexOf('&lt;script') != -1 ) {
+                        pee = pee.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
+                                return a.replace(/(\r\n|\n)/g, '&lt;wp_temp_br&gt;');
+                        });
+                }
+
</ins><span class="cx">                 pee = pee + '\n\n';
</span><span class="cx">                 pee = pee.replace(/&lt;br \/&gt;\s*&lt;br \/&gt;/gi, '\n\n');
</span><del>-                pee = pee.replace(new RegExp('(&lt;(?:'+blocklist+')[^&gt;]*&gt;)', 'gi'), '\n$1');
</del><ins>+                pee = pee.replace(new RegExp('(&lt;(?:'+blocklist+')(?: [^&gt;]*)?&gt;)', 'gi'), '\n$1');
</ins><span class="cx">                 pee = pee.replace(new RegExp('(&lt;/(?:'+blocklist+')&gt;)', 'gi'), '$1\n\n');
</span><ins>+                pee = pee.replace(/&lt;hr( [^&gt;]*)?&gt;/gi, '&lt;hr$1&gt;\n\n'); // hr is self closing block element
</ins><span class="cx">                 pee = pee.replace(/\r\n|\r/g, '\n');
</span><span class="cx">                 pee = pee.replace(/\n\s*\n+/g, '\n\n');
</span><span class="cx">                 pee = pee.replace(/([\s\S]+?)\n\n/g, '&lt;p&gt;$1&lt;/p&gt;\n');
</span><span class="cx">                 pee = pee.replace(/&lt;p&gt;\s*?&lt;\/p&gt;/gi, '');
</span><del>-                pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
</del><ins>+                pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')(?: [^&gt;]*)?&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
</ins><span class="cx">                 pee = pee.replace(/&lt;p&gt;(&lt;li.+?)&lt;\/p&gt;/gi, '$1');
</span><span class="cx">                 pee = pee.replace(/&lt;p&gt;\s*&lt;blockquote([^&gt;]*)&gt;/gi, '&lt;blockquote$1&gt;&lt;p&gt;');
</span><span class="cx">                 pee = pee.replace(/&lt;\/blockquote&gt;\s*&lt;\/p&gt;/gi, '&lt;/p&gt;&lt;/blockquote&gt;');
</span><del>-                pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)', 'gi'), &quot;$1&quot;);
-                pee = pee.replace(new RegExp('(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
</del><ins>+                pee = pee.replace(new RegExp('&lt;p&gt;\\s*(&lt;/?(?:'+blocklist+')(?: [^&gt;]*)?&gt;)', 'gi'), &quot;$1&quot;);
+                pee = pee.replace(new RegExp('(&lt;/?(?:'+blocklist+')(?: [^&gt;]*)?&gt;)\\s*&lt;/p&gt;', 'gi'), &quot;$1&quot;);
</ins><span class="cx">                 pee = pee.replace(/\s*\n/gi, '&lt;br /&gt;\n');
</span><span class="cx">                 pee = pee.replace(new RegExp('(&lt;/?(?:'+blocklist+')[^&gt;]*&gt;)\\s*&lt;br /&gt;', 'gi'), &quot;$1&quot;);
</span><span class="cx">                 pee = pee.replace(/&lt;br \/&gt;(\s*&lt;\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)&gt;)/gi, '$1');
</span><span class="cx">                 pee = pee.replace(/(?:&lt;p&gt;|&lt;br ?\/?&gt;)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:&lt;\/p&gt;|&lt;br ?\/?&gt;)*/gi, '[caption$1[/caption]');
</span><span class="cx"> 
</span><span class="cx">                 pee = pee.replace(/(&lt;(?:div|th|td|form|fieldset|dd)[^&gt;]*&gt;)(.*?)&lt;\/p&gt;/g, function(a, b, c) {
</span><del>-                        if ( c.match(/&lt;p( [^&gt;]+)?&gt;/) )
</del><ins>+                        if ( c.match(/&lt;p( [^&gt;]*)?&gt;/) )
</ins><span class="cx">                                 return a;
</span><span class="cx"> 
</span><span class="cx">                         return b + '&lt;p&gt;' + c + '&lt;/p&gt;';
</span><span class="cx">                 });
</span><span class="cx"> 
</span><del>-                // Fix the pre|script tags
-                pee = pee.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g, function(a) {
-                        a = a.replace(/&lt;br ?\/?&gt;[\r\n]*/g, '\n');
-                        return a.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g, '\n');
-                });
</del><ins>+                // put back the line breaks in pre|script
+                pee = pee.replace(/&lt;wp_temp_br&gt;/g, '\n');
</ins><span class="cx"> 
</span><span class="cx">                 return pee;
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkwpadminjseditorjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/editor.js (16393 => 16394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/editor.js        2010-11-15 23:48:24 UTC (rev 16393)
+++ trunk/wp-admin/js/editor.js        2010-11-15 23:57:27 UTC (rev 16394)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(document).ready(function(b){var a=wpCookies.getHash(&quot;TinyMCE_content_size&quot;);if(getUserSetting(&quot;editor&quot;)==&quot;html&quot;){if(a){b(&quot;#content&quot;).css(&quot;height&quot;,a.ch-15+&quot;px&quot;)}}else{if(typeof tinyMCE!=&quot;object&quot;){b(&quot;#content&quot;).css(&quot;color&quot;,&quot;#000&quot;)}else{b(&quot;#quicktags&quot;).hide()}}});var switchEditors={mode:&quot;&quot;,I:function(a){return document.getElementById(a)},_wp_Nop:function(b){var c,a;b=b.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g,function(d){d=d.replace(/&lt;br ?\/?&gt;[\r\n]*/g,&quot;&lt;wp_temp&gt;&quot;);return d.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g,&quot;&lt;wp_temp&gt;&quot;)});c=&quot;blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset&quot;;b=b.replace(new RegExp(&quot;\\s*&lt;/(&quot;+c+&quot;)&gt;\\s*&quot;,&quot;g&quot;),&quot;&lt;/$1&gt;\n&quot;);b=b.replace(new RegExp(&quot;\\s*&lt;((&quot;+c+&quot;)[^&gt;]*)&gt;&quot;,&quot;g&quot;),&quot;\n&lt;$1&gt;&quot;);b=b.replace(/(&lt;p [^&gt;]+&gt;.*?)&lt;\/p&gt;/g,&quot;$1&lt;/p#&gt;&quot;);b=b.replace(/&lt;div([^&gt;]*)&gt;\s*&lt;p&gt;/gi,&quot;&lt;div$1&gt;\n\n&quot;);b=b.replace(/\s*&lt;p&gt;/gi,&quot;&quot;);b=b.replace(/\s*&lt;\/p&gt;\s*/gi,&quot;\n\n&quot;);b=b.replace(/\n[\s\u00a0]+\n/g,&quot;\n\n&quot;);b=b.replace(/\s*&lt;br ?\/?&gt;\s*/gi,&quot;\n&quot;);b=b.replace(/\s*&lt;div/g,&quot;\n&lt;div&quot;);b=b.replace(/&lt;\/div&gt;\s*/g,&quot;&lt;/div&gt;\n&quot;);b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,&quot;\n\n[caption$1[/caption]\n\n&quot;);b=b.replace(/caption\]\n\n+\[caption/g,&quot;caption]\n\n[caption&quot;);a=&quot;blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset&quot;;b=b.replace(new RegExp(&quot;\\s*&lt;((&quot;+a+&quot;) ?[^&gt;]*)\\s*&gt;&quot;,&quot;g&quot;),&quot;\n&lt;$1&gt;&quot;);b=b.replace(new RegExp(&quot;\\s*&lt;/(&quot;+a+&quot;)&gt;\\s*&quot;,&quot;g&quot;),&quot;&lt;/$1&gt;\n&quot;);b=b.replace(/&lt;li([^&gt;]*)&gt;/g,&quot;\t&lt;li$1&gt;&quot;);if(b.indexOf(&quot;&lt;object&quot;)!=-1){b=b.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g,function(d){return d.replace(/[\r\n]+/g,&quot;&quot;)})}b=b.replace(/&lt;\/p#&gt;/g,&quot;&lt;/p&gt;\n&quot;);b=b.replace(/\s*(&lt;p [^&gt;]+&gt;[\s\S]*?&lt;\/p&gt;)/g,&quot;\n$1&quot;);b=b.replace(/^\s+/,&quot;&quot;);b=b.replace(/[\s\u00a0]+$/,&quot;&quot;);b=b.replace(/&lt;wp_temp&gt;/g,&quot;\n&quot;);return b},go:function(i,g){i=i||&quot;content&quot;;g=g||this.mode||&quot;&quot;;var b,h=this.I(&quot;quicktags&quot;),c=this.I(&quot;edButtonHTML&quot;),d=this.I(&quot;edButtonPreview&quot;),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if(&quot;tinymce&quot;==g){if(b&amp;&amp;!b.isHidden()){return false}setUserSetting(&quot;editor&quot;,&quot;tinymce&quot;);this.mode=&quot;html&quot;;d.className=&quot;active&quot;;c.className=&quot;&quot;;edCloseAllTags();h.style.display=&quot;none&quot;;a.style.color=&quot;#FFF&quot;;a.value=this.wpautop(a.value);try{if(b){b.show()}else{tinyMCE.execCommand(&quot;mceAddControl&quot;,false,i)}}catch(f){}a.style.color=&quot;#000&quot;}else{setUserSetting(&quot;editor&quot;,&quot;html&quot;);a.style.color=&quot;#000&quot;;this.mode=&quot;tinymce&quot;;c.className=&quot;active&quot;;d.className=&quot;&quot;;if(b&amp;&amp;!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+&quot;px&quot;;b.hide()}h.style.display=&quot;block&quot;}return false},_wp_Autop:function(a){var b=&quot;table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend&quot;;if(a.indexOf(&quot;&lt;object&quot;)!=-1){a=a.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g,function(c){return c.replace(/[\r\n]+/g,&quot;&quot;)})}a=a.replace(/&lt;[^&lt;&gt;]+&gt;/g,function(c){return c.replace(/[\r\n]+/g,&quot; &quot;)});a=a+&quot;\n\n&quot;;a=a.replace(/&lt;br \/&gt;\s*&lt;br \/&gt;/gi,&quot;\n\n&quot;);a=a.replace(new RegExp(&quot;(&lt;(?:&quot;+b+&quot;)[^&gt;]*&gt;)&quot;,&quot;gi&quot;),&quot;\n$1&quot;);a=a.replace(new RegExp(&quot;(&lt;/(?:&quot;+b+&quot;)&gt;)&quot;,&quot;gi&quot;),&quot;$1\n\n&quot;);a=a.replace(/\r\n|\r/g,&quot;\n&quot;);a=a.replace(/\n\s*\n+/g,&quot;\n\n&quot;);a=a.replace(/([\s\S]+?)\n\n/g,&quot;&lt;p&gt;$1&lt;/p&gt;\n&quot;);a=a.replace(/&lt;p&gt;\s*?&lt;\/p&gt;/gi,&quot;&quot;);a=a.replace(new RegExp(&quot;&lt;p&gt;\\s*(&lt;/?(?:&quot;+b+&quot;)[^&gt;]*&gt;)\\s*&lt;/p&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/&lt;p&gt;(&lt;li.+?)&lt;\/p&gt;/gi,&quot;$1&quot;);a=a.replace(/&lt;p&gt;\s*&lt;blockquote([^&gt;]*)&gt;/gi,&quot;&lt;blockquote$1&gt;&lt;p&gt;&quot;);a=a.replace(/&lt;\/blockquote&gt;\s*&lt;\/p&gt;/gi,&quot;&lt;/p&gt;&lt;/blockquote&gt;&quot;);a=a.replace(new RegExp(&quot;&lt;p&gt;\\s*(&lt;/?(?:&quot;+b+&quot;)[^&gt;]*&gt;)&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(new RegExp(&quot;(&lt;/?(?:&quot;+b+&quot;)[^&gt;]*&gt;)\\s*&lt;/p&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/\s*\n/gi,&quot;&lt;br /&gt;\n&quot;);a=a.replace(new RegExp(&quot;(&lt;/?(?:&quot;+b+&quot;)[^&gt;]*&gt;)\\s*&lt;br /&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/&lt;br \/&gt;(\s*&lt;\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)&gt;)/gi,&quot;$1&quot;);a=a.replace(/(?:&lt;p&gt;|&lt;br ?\/?&gt;)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:&lt;\/p&gt;|&lt;br ?\/?&gt;)*/gi,&quot;[caption$1[/caption]&quot;);a=a.replace(/(&lt;(?:div|th|td|form|fieldset|dd)[^&gt;]*&gt;)(.*?)&lt;\/p&gt;/g,function(e,d,f){if(f.match(/&lt;p( [^&gt;]+)?&gt;/)){return e}return d+&quot;&lt;p&gt;&quot;+f+&quot;&lt;/p&gt;&quot;});a=a.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g,function(c){c=c.replace(/&lt;br ?\/?&gt;[\r\n]*/g,&quot;\n&quot;);return c.replace(/&lt;\/?p( [^&gt;]*)?&gt;[\r\n]*/g,&quot;\n&quot;)});return a},pre_wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery(&quot;body&quot;).trigger(&quot;beforePreWpautop&quot;,[c]);c.data=a._wp_Nop(c.data);jQuery(&quot;body&quot;).trigger(&quot;afterPreWpautop&quot;,[c]);return c.data},wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery(&quot;body&quot;).trigger(&quot;beforeWpautop&quot;,[c]);c.data=a._wp_Autop(c.data);jQuery(&quot;body&quot;).trigger(&quot;afterWpautop&quot;,[c]);return c.data}};
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function(b){var a=wpCookies.getHash(&quot;TinyMCE_content_size&quot;);if(getUserSetting(&quot;editor&quot;)==&quot;html&quot;){if(a){b(&quot;#content&quot;).css(&quot;height&quot;,a.ch-15+&quot;px&quot;)}}else{if(typeof tinyMCE!=&quot;object&quot;){b(&quot;#content&quot;).css(&quot;color&quot;,&quot;#000&quot;)}else{b(&quot;#quicktags&quot;).hide()}}});var switchEditors={mode:&quot;&quot;,I:function(a){return document.getElementById(a)},_wp_Nop:function(b){var c,a;if(b.indexOf(&quot;&lt;pre&quot;)!=-1||b.indexOf(&quot;&lt;script&quot;)!=-1){b=b.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g,function(d){d=d.replace(/&lt;br ?\/?&gt;(\r\n|\n)?/g,&quot;&lt;wp_temp&gt;&quot;);return d.replace(/&lt;\/?p( [^&gt;]*)?&gt;(\r\n|\n)?/g,&quot;&lt;wp_temp&gt;&quot;)})}c=&quot;blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset&quot;;b=b.replace(new RegExp(&quot;\\s*&lt;/(&quot;+c+&quot;)&gt;\\s*&quot;,&quot;g&quot;),&quot;&lt;/$1&gt;\n&quot;);b=b.replace(new RegExp(&quot;\\s*&lt;((?:&quot;+c+&quot;)(?: [^&gt;]*)?)&gt;&quot;,&quot;g&quot;),&quot;\n&lt;$1&gt;&quot;);b=b.replace(/(&lt;p [^&gt;]+&gt;.*?)&lt;\/p&gt;/g,&quot;$1&lt;/p#&gt;&quot;);b=b.replace(/&lt;div( [^&gt;]*)?&gt;\s*&lt;p&gt;/gi,&quot;&lt;div$1&gt;\n\n&quot;);b=b.replace(/\s*&lt;p&gt;/gi,&quot;&quot;);b=b.replace(/\s*&lt;\/p&gt;\s*/gi,&quot;\n\n&quot;);b=b.replace(/\n[\s\u00a0]+\n/g,&quot;\n\n&quot;);b=b.replace(/\s*&lt;br ?\/?&gt;\s*/gi,&quot;\n&quot;);b=b.replace(/\s*&lt;div/g,&quot;\n&lt;div&quot;);b=b.replace(/&lt;\/div&gt;\s*/g,&quot;&lt;/div&gt;\n&quot;);b=b.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,&quot;\n\n[caption$1[/caption]\n\n&quot;);b=b.replace(/caption\]\n\n+\[caption/g,&quot;caption]\n\n[caption&quot;);a=&quot;blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset&quot;;b=b.replace(new RegExp(&quot;\\s*&lt;((?:&quot;+a+&quot;)(?: [^&gt;]*)?)\\s*&gt;&quot;,&quot;g&quot;),&quot;\n&lt;$1&gt;&quot;);b=b.replace(new RegExp(&quot;\\s*&lt;/(&quot;+a+&quot;)&gt;\\s*&quot;,&quot;g&quot;),&quot;&lt;/$1&gt;\n&quot;);b=b.replace(/&lt;li([^&gt;]*)&gt;/g,&quot;\t&lt;li$1&gt;&quot;);if(b.indexOf(&quot;&lt;hr&quot;)!=-1){b=b.replace(/\s*&lt;hr( [^&gt;]*)?&gt;\s*/g,&quot;\n\n&lt;hr$1&gt;\n\n&quot;)}if(b.indexOf(&quot;&lt;object&quot;)!=-1){b=b.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g,function(d){return d.replace(/[\r\n]+/g,&quot;&quot;)})}b=b.replace(/&lt;\/p#&gt;/g,&quot;&lt;/p&gt;\n&quot;);b=b.replace(/\s*(&lt;p [^&gt;]+&gt;[\s\S]*?&lt;\/p&gt;)/g,&quot;\n$1&quot;);b=b.replace(/^\s+/,&quot;&quot;);b=b.replace(/[\s\u00a0]+$/,&quot;&quot;);b=b.replace(/&lt;wp_temp&gt;/g,&quot;\n&quot;);return b},go:function(i,g){i=i||&quot;content&quot;;g=g||this.mode||&quot;&quot;;var b,h=this.I(&quot;quicktags&quot;),c=this.I(&quot;edButtonHTML&quot;),d=this.I(&quot;edButtonPreview&quot;),a=this.I(i);try{b=tinyMCE.get(i)}catch(f){b=false}if(&quot;tinymce&quot;==g){if(b&amp;&amp;!b.isHidden()){return false}setUserSetting(&quot;editor&quot;,&quot;tinymce&quot;);this.mode=&quot;html&quot;;d.className=&quot;active&quot;;c.className=&quot;&quot;;edCloseAllTags();h.style.display=&quot;none&quot;;a.style.color=&quot;#FFF&quot;;a.value=this.wpautop(a.value);try{if(b){b.show()}else{tinyMCE.execCommand(&quot;mceAddControl&quot;,false,i)}}catch(f){}a.style.color=&quot;#000&quot;}else{setUserSetting(&quot;editor&quot;,&quot;html&quot;);a.style.color=&quot;#000&quot;;this.mode=&quot;tinymce&quot;;c.className=&quot;active&quot;;d.className=&quot;&quot;;if(b&amp;&amp;!b.isHidden()){a.style.height=b.getContentAreaContainer().offsetHeight+24+&quot;px&quot;;b.hide()}h.style.display=&quot;block&quot;}return false},_wp_Autop:function(a){var b=&quot;table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr&quot;;if(a.indexOf(&quot;&lt;object&quot;)!=-1){a=a.replace(/&lt;object[\s\S]+?&lt;\/object&gt;/g,function(c){return c.replace(/[\r\n]+/g,&quot;&quot;)})}a=a.replace(/&lt;[^&lt;&gt;]+&gt;/g,function(c){return c.replace(/[\r\n]+/g,&quot; &quot;)});if(a.indexOf(&quot;&lt;pre&quot;)!=-1||a.indexOf(&quot;&lt;script&quot;)!=-1){a=a.replace(/&lt;(pre|script)[^&gt;]*&gt;[\s\S]+?&lt;\/\1&gt;/g,function(c){return c.replace(/(\r\n|\n)/g,&quot;&lt;wp_temp_br&gt;&quot;)})}a=a+&quot;\n\n&quot;;a=a.replace(/&lt;br \/&gt;\s*&lt;br \/&gt;/gi,&quot;\n\n&quot;);a=a.replace(new RegExp(&quot;(&lt;(?:&quot;+b+&quot;)(?: [^&gt;]*)?&gt;)&quot;,&quot;gi&quot;),&quot;\n$1&quot;);a=a.replace(new RegExp(&quot;(&lt;/(?:&quot;+b+&quot;)&gt;)&quot;,&quot;gi&quot;),&quot;$1\n\n&quot;);a=a.replace(/&lt;hr( [^&gt;]*)?&gt;/gi,&quot;&lt;hr$1&gt;\n\n&quot;);a=a.replace(/\r\n|\r/g,&quot;\n&quot;);a=a.replace(/\n\s*\n+/g,&quot;\n\n&quot;);a=a.replace(/([\s\S]+?)\n\n/g,&quot;&lt;p&gt;$1&lt;/p&gt;\n&quot;);a=a.replace(/&lt;p&gt;\s*?&lt;\/p&gt;/gi,&quot;&quot;);a=a.replace(new RegExp(&quot;&lt;p&gt;\\s*(&lt;/?(?:&quot;+b+&quot;)(?: [^&gt;]*)?&gt;)\\s*&lt;/p&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/&lt;p&gt;(&lt;li.+?)&lt;\/p&gt;/gi,&quot;$1&quot;);a=a.replace(/&lt;p&gt;\s*&lt;blockquote([^&gt;]*)&gt;/gi,&quot;&lt;blockquote$1&gt;&lt;p&gt;&quot;);a=a.replace(/&lt;\/blockquote&gt;\s*&lt;\/p&gt;/gi,&quot;&lt;/p&gt;&lt;/blockquote&gt;&quot;);a=a.replace(new RegExp(&quot;&lt;p&gt;\\s*(&lt;/?(?:&quot;+b+&quot;)(?: [^&gt;]*)?&gt;)&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(new RegExp(&quot;(&lt;/?(?:&quot;+b+&quot;)(?: [^&gt;]*)?&gt;)\\s*&lt;/p&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/\s*\n/gi,&quot;&lt;br /&gt;\n&quot;);a=a.replace(new RegExp(&quot;(&lt;/?(?:&quot;+b+&quot;)[^&gt;]*&gt;)\\s*&lt;br /&gt;&quot;,&quot;gi&quot;),&quot;$1&quot;);a=a.replace(/&lt;br \/&gt;(\s*&lt;\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)&gt;)/gi,&quot;$1&quot;);a=a.replace(/(?:&lt;p&gt;|&lt;br ?\/?&gt;)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:&lt;\/p&gt;|&lt;br ?\/?&gt;)*/gi,&quot;[caption$1[/caption]&quot;);a=a.replace(/(&lt;(?:div|th|td|form|fieldset|dd)[^&gt;]*&gt;)(.*?)&lt;\/p&gt;/g,function(e,d,f){if(f.match(/&lt;p( [^&gt;]*)?&gt;/)){return e}return d+&quot;&lt;p&gt;&quot;+f+&quot;&lt;/p&gt;&quot;});a=a.replace(/&lt;wp_temp_br&gt;/g,&quot;\n&quot;);return a},pre_wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery(&quot;body&quot;).trigger(&quot;beforePreWpautop&quot;,[c]);c.data=a._wp_Nop(c.data);jQuery(&quot;body&quot;).trigger(&quot;afterPreWpautop&quot;,[c]);return c.data},wpautop:function(b){var a=this,c={o:a,data:b,unfiltered:b};jQuery(&quot;body&quot;).trigger(&quot;beforeWpautop&quot;,[c]);c.data=a._wp_Autop(c.data);jQuery(&quot;body&quot;).trigger(&quot;afterWpautop&quot;,[c]);return c.data}};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswordpresseditor_plugindevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js (16393 => 16394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js        2010-11-15 23:48:24 UTC (rev 16393)
+++ trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js        2010-11-15 23:57:27 UTC (rev 16394)
</span><span class="lines">@@ -166,6 +166,7 @@
</span><span class="cx">                         });
</span><span class="cx">                         
</span><span class="cx">                         ed.onInit.add(function(ed) {
</span><ins>+                                // make sure these run last
</ins><span class="cx">                                 ed.onNodeChange.add( function(ed, cm, e) {
</span><span class="cx">                                         var DL;
</span><span class="cx"> 
</span><span class="lines">@@ -187,6 +188,14 @@
</span><span class="cx">                                                         cm.setActive('justifycenter', 1);
</span><span class="cx">                                         }
</span><span class="cx">                                 });
</span><ins>+
+                                // remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
+                                ed.onBeforeSetContent.add(function(ed, o) {
+                                        if ( o.content ) {
+                                                o.content = o.content.replace(/&lt;p&gt;\s*&lt;(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^&gt;]*)?&gt;/gi, '&lt;$1$2&gt;');
+                                                o.content = o.content.replace(/&lt;\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)&gt;\s*&lt;\/p&gt;/gi, '&lt;/$1&gt;');
+                                        }
+                                });
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         // Word count if script is loaded
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswordpresseditor_pluginjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js (16393 => 16394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js        2010-11-15 23:48:24 UTC (rev 16393)
+++ trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js        2010-11-15 23:57:27 UTC (rev 16394)
</span><span class="lines">@@ -1 +1 @@
</span><del>-(function(){var a=tinymce.DOM;tinymce.create(&quot;tinymce.plugins.WordPress&quot;,{mceTout:0,init:function(c,d){var e=this,h=c.getParam(&quot;wordpress_adv_toolbar&quot;,&quot;toolbar2&quot;),g=0,f,b;f='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPmore mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_more_alt&quot;)+'&quot; /&gt;';b='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPnextpage mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_page_alt&quot;)+'&quot; /&gt;';if(getUserSetting(&quot;hidetb&quot;,&quot;0&quot;)==&quot;1&quot;){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam(&quot;wordpress_adv_hidden&quot;,1)&amp;&amp;i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand(&quot;WP_More&quot;,function(){c.execCommand(&quot;mceInsertContent&quot;,0,f)});c.addCommand(&quot;WP_Page&quot;,function(){c.execCommand(&quot;mceInsertContent&quot;,0,b)});c.addCommand(&quot;WP_Help&quot;,function(){c.windowManager.open({url:tinymce.baseURL+&quot;/wp-mce-help.php&quot;,width:450,height:420,inline:1})});c.addCommand(&quot;WP_Adv&quot;,function(){var i=c.controlManager,j=i.get(h).id;if(&quot;undefined&quot;==j){return}if(a.isHidden(j)){i.setActive(&quot;wp_adv&quot;,1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting(&quot;hidetb&quot;,&quot;1&quot;)}else{i.setActive(&quot;wp_adv&quot;,0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting(&quot;hidetb&quot;,&quot;0&quot;)}});c.addButton(&quot;wp_more&quot;,{title:&quot;wordpress.wp_more_desc&quot;,image:d+&quot;/img/more.gif&quot;,cmd:&quot;WP_More&quot;});c.addButton(&quot;wp_page&quot;,{title:&quot;wordpress.wp_page_desc&quot;,image:d+&quot;/img/page.gif&quot;,cmd:&quot;WP_Page&quot;});c.addButton(&quot;wp_help&quot;,{title:&quot;wordpress.wp_help_desc&quot;,image:d+&quot;/img/help.gif&quot;,cmd:&quot;WP_Help&quot;});c.addButton(&quot;wp_adv&quot;,{title:&quot;wordpress.wp_adv_desc&quot;,image:d+&quot;/img/toolbars.gif&quot;,cmd:&quot;WP_Adv&quot;});c.addButton(&quot;add_media&quot;,{title:&quot;wordpress.add_media&quot;,image:d+&quot;/img/media.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_media&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_image&quot;,{title:&quot;wordpress.add_image&quot;,image:d+&quot;/img/image.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_image&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_video&quot;,{title:&quot;wordpress.add_video&quot;,image:d+&quot;/img/video.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_video&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_audio&quot;,{title:&quot;wordpress.add_audio&quot;,image:d+&quot;/img/audio.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_audio&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.onBeforeExecCommand.add(function(p,m,s,l,j){var v=tinymce.DOM,k,i,r,u,t,q;if(&quot;mceFullScreen&quot;==m){if(&quot;mce_fullscreen&quot;!=p.id&amp;&amp;v.get(&quot;add_audio&quot;)&amp;&amp;v.get(&quot;add_video&quot;)&amp;&amp;v.get(&quot;add_image&quot;)&amp;&amp;v.get(&quot;add_media&quot;)){p.settings.theme_advanced_buttons1+=&quot;,|,add_image,add_video,add_audio,add_media&quot;}}if(&quot;JustifyLeft&quot;==m||&quot;JustifyRight&quot;==m||&quot;JustifyCenter&quot;==m){k=p.selection.getNode();if(k.nodeName==&quot;IMG&quot;){q=m.substr(7).toLowerCase();t=&quot;align&quot;+q;i=p.dom.getParent(k,&quot;dl.wp-caption&quot;);r=p.dom.getParent(k,&quot;div.mceTemp&quot;);if(i&amp;&amp;r){u=p.dom.hasClass(i,t)?&quot;alignnone&quot;:t;i.className=i.className.replace(/align[^ '&quot;]+\s?/g,&quot;&quot;);p.dom.addClass(i,u);if(u==&quot;aligncenter&quot;){p.dom.addClass(r,&quot;mceIEcenter&quot;)}else{p.dom.removeClass(r,&quot;mceIEcenter&quot;)}j.terminate=true;p.execCommand(&quot;mceRepaint&quot;)}else{if(p.dom.hasClass(k,t)){p.dom.addClass(k,&quot;alignnone&quot;)}else{p.dom.removeClass(k,&quot;alignnone&quot;)}}}}});c.onInit.add(function(i){i.onNodeChange.add(function(k,j,m){var l;if(m.nodeName==&quot;IMG&quot;){l=k.dom.getParent(m,&quot;dl.wp-caption&quot;)}else{if(m.nodeName==&quot;DIV&quot;&amp;&amp;k.dom.hasClass(m,&quot;mceTemp&quot;)){l=m.firstChild;if(!k.dom.hasClass(l,&quot;wp-caption&quot;)){l=false}}}if(l){if(k.dom.hasClass(l,&quot;alignleft&quot;)){j.setActive(&quot;justifyleft&quot;,1)}else{if(k.dom.hasClass(l,&quot;alignright&quot;)){j.setActive(&quot;justifyright&quot;,1)}else{if(k.dom.hasClass(l,&quot;aligncenter&quot;)){j.setActive(&quot;justifycenter&quot;,1)}}}}})});if(&quot;undefined&quot;!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:&quot;raw&quot;}))}g=j.keyCode})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)==&quot;object&quot;){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut(&quot;alt+shift+c&quot;,c.getLang(&quot;justifycenter_desc&quot;),&quot;JustifyCenter&quot;);c.addShortcut(&quot;alt+shift+r&quot;,c.getLang(&quot;justifyright_desc&quot;),&quot;JustifyRight&quot;);c.addShortcut(&quot;alt+shift+l&quot;,c.getLang(&quot;justifyleft_desc&quot;),&quot;JustifyLeft&quot;);c.addShortcut(&quot;alt+shift+j&quot;,c.getLang(&quot;justifyfull_desc&quot;),&quot;JustifyFull&quot;);c.addShortcut(&quot;alt+shift+q&quot;,c.getLang(&quot;blockquote_desc&quot;),&quot;mceBlockQuote&quot;);c.addShortcut(&quot;alt+shift+u&quot;,c.getLang(&quot;bullist_desc&quot;),&quot;InsertUnorderedList&quot;);c.addShortcut(&quot;alt+shift+o&quot;,c.getLang(&quot;numlist_desc&quot;),&quot;InsertOrderedList&quot;);c.addShortcut(&quot;alt+shift+d&quot;,c.getLang(&quot;striketrough_desc&quot;),&quot;Strikethrough&quot;);c.addShortcut(&quot;alt+shift+n&quot;,c.getLang(&quot;spellchecker.desc&quot;),&quot;mceSpellCheck&quot;);c.addShortcut(&quot;alt+shift+a&quot;,c.getLang(&quot;link_desc&quot;),&quot;mceLink&quot;);c.addShortcut(&quot;alt+shift+s&quot;,c.getLang(&quot;unlink_desc&quot;),&quot;unlink&quot;);c.addShortcut(&quot;alt+shift+m&quot;,c.getLang(&quot;image_desc&quot;),&quot;mceImage&quot;);c.addShortcut(&quot;alt+shift+g&quot;,c.getLang(&quot;fullscreen.desc&quot;),&quot;mceFullScreen&quot;);c.addShortcut(&quot;alt+shift+z&quot;,c.getLang(&quot;wp_adv_desc&quot;),&quot;WP_Adv&quot;);c.addShortcut(&quot;alt+shift+h&quot;,c.getLang(&quot;help_desc&quot;),&quot;WP_Help&quot;);c.addShortcut(&quot;alt+shift+t&quot;,c.getLang(&quot;wp_more_desc&quot;),&quot;WP_More&quot;);c.addShortcut(&quot;alt+shift+p&quot;,c.getLang(&quot;wp_page_desc&quot;),&quot;WP_Page&quot;);c.addShortcut(&quot;ctrl+s&quot;,c.getLang(&quot;save_desc&quot;),function(){if(&quot;function&quot;==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut(&quot;alt+shift+b&quot;,c.getLang(&quot;bold_desc&quot;),&quot;Bold&quot;);c.addShortcut(&quot;alt+shift+i&quot;,c.getLang(&quot;italic_desc&quot;),&quot;Italic&quot;)}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),&quot;scroll&quot;,function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),&quot;dragstart&quot;,function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!=&quot;IMG&quot;){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:&quot;WordPress Plugin&quot;,author:&quot;WordPress&quot;,authorurl:&quot;http://wordpress.org&quot;,infourl:&quot;http://wordpress.org&quot;,version:&quot;3.0&quot;}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return'&lt;img width=&quot;300&quot; height=&quot;200&quot; src=&quot;'+tinymce.baseURL+'/plugins/wordpress/img/trans.gif&quot; class=&quot;wp-oembed mceItemNoResize&quot; alt=&quot;'+c+'&quot; title=&quot;'+c+'&quot; /&gt;'})},_getEmbed:function(b){return b.replace(/&lt;img[^&gt;]+&gt;/g,function(c){if(c.indexOf('class=&quot;wp-oembed')!=-1){var d=c.match(/alt=&quot;([^\&quot;]+)&quot;/);if(d[1]){c=&quot;[embed]&quot;+d[1]+&quot;[/embed]&quot;}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+&quot;px&quot;,left:e+5+&quot;px&quot;,display:&quot;block&quot;});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById(&quot;wp_editbtns&quot;)){tinymce.DOM.hide(&quot;wp_editbtns&quot;)}if(document.getElementById(&quot;wp_gallerybtns&quot;)){tinymce.DOM.hide(&quot;wp_gallerybtns&quot;)}clearTimeout(this.mceTout);this.mceTout=0},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,&quot;height&quot;,d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='&lt;img src=&quot;'+d+'/img/trans.gif&quot; alt=&quot;$1&quot; class=&quot;mceWPmore mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_more_alt&quot;)+'&quot; /&gt;';b='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPnextpage mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_page_alt&quot;)+'&quot; /&gt;';c.onInit.add(function(){c.dom.loadCSS(d+&quot;/css/content.css&quot;)});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName==&quot;IMG&quot;){if(c.dom.hasClass(g.node,&quot;mceWPmore&quot;)){g.name=&quot;wpmore&quot;}if(c.dom.hasClass(g.node,&quot;mceWPnextpage&quot;)){g.name=&quot;wppage&quot;}}})}});c.onBeforeSetContent.add(function(f,g){if(g.content){g.content=g.content.replace(/&lt;!--more(.*?)--&gt;/g,e);g.content=g.content.replace(/&lt;!--nextpage--&gt;/g,b)}});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/&lt;img[^&gt;]+&gt;/g,function(i){if(i.indexOf('class=&quot;mceWPmore')!==-1){var h,j=(h=i.match(/alt=&quot;(.*?)&quot;/))?h[1]:&quot;&quot;;i=&quot;&lt;!--more&quot;+j+&quot;--&gt;&quot;}if(i.indexOf('class=&quot;mceWPnextpage')!==-1){i=&quot;&lt;!--nextpage--&gt;&quot;}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive(&quot;wp_page&quot;,h.nodeName===&quot;IMG&quot;&amp;&amp;g.dom.hasClass(h,&quot;mceWPnextpage&quot;));f.setActive(&quot;wp_more&quot;,h.nodeName===&quot;IMG&quot;&amp;&amp;g.dom.hasClass(h,&quot;mceWPmore&quot;))})}});tinymce.PluginManager.add(&quot;wordpress&quot;,tinymce.plugins.WordPress)})();
</del><span class="cx">\ No newline at end of file
</span><ins>+(function(){var a=tinymce.DOM;tinymce.create(&quot;tinymce.plugins.WordPress&quot;,{mceTout:0,init:function(c,d){var e=this,h=c.getParam(&quot;wordpress_adv_toolbar&quot;,&quot;toolbar2&quot;),g=0,f,b;f='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPmore mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_more_alt&quot;)+'&quot; /&gt;';b='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPnextpage mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_page_alt&quot;)+'&quot; /&gt;';if(getUserSetting(&quot;hidetb&quot;,&quot;0&quot;)==&quot;1&quot;){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam(&quot;wordpress_adv_hidden&quot;,1)&amp;&amp;i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand(&quot;WP_More&quot;,function(){c.execCommand(&quot;mceInsertContent&quot;,0,f)});c.addCommand(&quot;WP_Page&quot;,function(){c.execCommand(&quot;mceInsertContent&quot;,0,b)});c.addCommand(&quot;WP_Help&quot;,function(){c.windowManager.open({url:tinymce.baseURL+&quot;/wp-mce-help.php&quot;,width:450,height:420,inline:1})});c.addCommand(&quot;WP_Adv&quot;,function(){var i=c.controlManager,j=i.get(h).id;if(&quot;undefined&quot;==j){return}if(a.isHidden(j)){i.setActive(&quot;wp_adv&quot;,1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting(&quot;hidetb&quot;,&quot;1&quot;)}else{i.setActive(&quot;wp_adv&quot;,0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting(&quot;hidetb&quot;,&quot;0&quot;)}});c.addButton(&quot;wp_more&quot;,{title:&quot;wordpress.wp_more_desc&quot;,image:d+&quot;/img/more.gif&quot;,cmd:&quot;WP_More&quot;});c.addButton(&quot;wp_page&quot;,{title:&quot;wordpress.wp_page_desc&quot;,image:d+&quot;/img/page.gif&quot;,cmd:&quot;WP_Page&quot;});c.addButton(&quot;wp_help&quot;,{title:&quot;wordpress.wp_help_desc&quot;,image:d+&quot;/img/help.gif&quot;,cmd:&quot;WP_Help&quot;});c.addButton(&quot;wp_adv&quot;,{title:&quot;wordpress.wp_adv_desc&quot;,image:d+&quot;/img/toolbars.gif&quot;,cmd:&quot;WP_Adv&quot;});c.addButton(&quot;add_media&quot;,{title:&quot;wordpress.add_media&quot;,image:d+&quot;/img/media.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_media&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_image&quot;,{title:&quot;wordpress.add_image&quot;,image:d+&quot;/img/image.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_image&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_video&quot;,{title:&quot;wordpress.add_video&quot;,image:d+&quot;/img/video.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_video&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.addButton(&quot;add_audio&quot;,{title:&quot;wordpress.add_audio&quot;,image:d+&quot;/img/audio.gif&quot;,onclick:function(){tb_show(&quot;&quot;,tinymce.DOM.get(&quot;add_audio&quot;).href);tinymce.DOM.setStyle([&quot;TB_overlay&quot;,&quot;TB_window&quot;,&quot;TB_load&quot;],&quot;z-index&quot;,&quot;999999&quot;)}});c.onBeforeExecCommand.add(function(p,m,s,l,j){var v=tinymce.DOM,k,i,r,u,t,q;if(&quot;mceFullScreen&quot;==m){if(&quot;mce_fullscreen&quot;!=p.id&amp;&amp;v.get(&quot;add_audio&quot;)&amp;&amp;v.get(&quot;add_video&quot;)&amp;&amp;v.get(&quot;add_image&quot;)&amp;&amp;v.get(&quot;add_media&quot;)){p.settings.theme_advanced_buttons1+=&quot;,|,add_image,add_video,add_audio,add_media&quot;}}if(&quot;JustifyLeft&quot;==m||&quot;JustifyRight&quot;==m||&quot;JustifyCenter&quot;==m){k=p.selection.getNode();if(k.nodeName==&quot;IMG&quot;){q=m.substr(7).toLowerCase();t=&quot;align&quot;+q;i=p.dom.getParent(k,&quot;dl.wp-caption&quot;);r=p.dom.getParent(k,&quot;div.mceTemp&quot;);if(i&amp;&amp;r){u=p.dom.hasClass(i,t)?&quot;alignnone&quot;:t;i.className=i.className.replace(/align[^ '&quot;]+\s?/g,&quot;&quot;);p.dom.addClass(i,u);if(u==&quot;aligncenter&quot;){p.dom.addClass(r,&quot;mceIEcenter&quot;)}else{p.dom.removeClass(r,&quot;mceIEcenter&quot;)}j.terminate=true;p.execCommand(&quot;mceRepaint&quot;)}else{if(p.dom.hasClass(k,t)){p.dom.addClass(k,&quot;alignnone&quot;)}else{p.dom.removeClass(k,&quot;alignnone&quot;)}}}}});c.onInit.add(function(i){i.onNodeChange.add(function(k,j,m){var l;if(m.nodeName==&quot;IMG&quot;){l=k.dom.getParent(m,&quot;dl.wp-caption&quot;)}else{if(m.nodeName==&quot;DIV&quot;&amp;&amp;k.dom.hasClass(m,&quot;mceTemp&quot;)){l=m.firstChild;if(!k.dom.hasClass(l,&quot;wp-caption&quot;)){l=false}}}if(l){if(k.dom.hasClass(l,&quot;alignleft&quot;)){j.setActive(&quot;justifyleft&quot;,1)}else{if(k.dom.hasClass(l,&quot;alignright&quot;)){j.setActive(&quot;justifyright&quot;,1)}else{if(k.dom.hasClass(l,&quot;aligncenter&quot;)){j.setActive(&quot;justifycenter&quot;,1)}}}}});i.onBeforeSetContent.add(function(j,k){if(k.content){k.content=k.content.replace(/&lt;p&gt;\s*&lt;(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^&gt;]*)?&gt;/gi,&quot;&lt;$1$2&gt;&quot;);k.content=k.content.replace(/&lt;\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)&gt;\s*&lt;\/p&gt;/gi,&quot;&lt;/$1&gt;&quot;)}})});if(&quot;undefined&quot;!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:&quot;raw&quot;}))}g=j.keyCode})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)==&quot;object&quot;){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut(&quot;alt+shift+c&quot;,c.getLang(&quot;justifycenter_desc&quot;),&quot;JustifyCenter&quot;);c.addShortcut(&quot;alt+shift+r&quot;,c.getLang(&quot;justifyright_desc&quot;),&quot;JustifyRight&quot;);c.addShortcut(&quot;alt+shift+l&quot;,c.getLang(&quot;justifyleft_desc&quot;),&quot;JustifyLeft&quot;);c.addShortcut(&quot;alt+shift+j&quot;,c.getLang(&quot;justifyfull_desc&quot;),&quot;JustifyFull&quot;);c.addShortcut(&quot;alt+shift+q&quot;,c.getLang(&quot;blockquote_desc&quot;),&quot;mceBlockQuote&quot;);c.addShortcut(&quot;alt+shift+u&quot;,c.getLang(&quot;bullist_desc&quot;),&quot;InsertUnorderedList&quot;);c.addShortcut(&quot;alt+shift+o&quot;,c.getLang(&quot;numlist_desc&quot;),&quot;InsertOrderedList&quot;);c.addShortcut(&quot;alt+shift+d&quot;,c.getLang(&quot;striketrough_desc&quot;),&quot;Strikethrough&quot;);c.addShortcut(&quot;alt+shift+n&quot;,c.getLang(&quot;spellchecker.desc&quot;),&quot;mceSpellCheck&quot;);c.addShortcut(&quot;alt+shift+a&quot;,c.getLang(&quot;link_desc&quot;),&quot;mceLink&quot;);c.addShortcut(&quot;alt+shift+s&quot;,c.getLang(&quot;unlink_desc&quot;),&quot;unlink&quot;);c.addShortcut(&quot;alt+shift+m&quot;,c.getLang(&quot;image_desc&quot;),&quot;mceImage&quot;);c.addShortcut(&quot;alt+shift+g&quot;,c.getLang(&quot;fullscreen.desc&quot;),&quot;mceFullScreen&quot;);c.addShortcut(&quot;alt+shift+z&quot;,c.getLang(&quot;wp_adv_desc&quot;),&quot;WP_Adv&quot;);c.addShortcut(&quot;alt+shift+h&quot;,c.getLang(&quot;help_desc&quot;),&quot;WP_Help&quot;);c.addShortcut(&quot;alt+shift+t&quot;,c.getLang(&quot;wp_more_desc&quot;),&quot;WP_More&quot;);c.addShortcut(&quot;alt+shift+p&quot;,c.getLang(&quot;wp_page_desc&quot;),&quot;WP_Page&quot;);c.addShortcut(&quot;ctrl+s&quot;,c.getLang(&quot;save_desc&quot;),function(){if(&quot;function&quot;==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut(&quot;alt+shift+b&quot;,c.getLang(&quot;bold_desc&quot;),&quot;Bold&quot;);c.addShortcut(&quot;alt+shift+i&quot;,c.getLang(&quot;italic_desc&quot;),&quot;Italic&quot;)}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),&quot;scroll&quot;,function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),&quot;dragstart&quot;,function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!=&quot;IMG&quot;){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:&quot;WordPress Plugin&quot;,author:&quot;WordPress&quot;,authorurl:&quot;http://wordpress.org&quot;,infourl:&quot;http://wordpress.org&quot;,version:&quot;3.0&quot;}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return'&lt;img width=&quot;300&quot; height=&quot;200&quot; src=&quot;'+tinymce.baseURL+'/plugins/wordpress/img/trans.gif&quot; class=&quot;wp-oembed mceItemNoResize&quot; alt=&quot;'+c+'&quot; title=&quot;'+c+'&quot; /&gt;'})},_getEmbed:function(b){return b.replace(/&lt;img[^&gt;]+&gt;/g,function(c){if(c.indexOf('class=&quot;wp-oembed')!=-1){var d=c.match(/alt=&quot;([^\&quot;]+)&quot;/);if(d[1]){c=&quot;[embed]&quot;+d[1]+&quot;[/embed]&quot;}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+&quot;px&quot;,left:e+5+&quot;px&quot;,display:&quot;block&quot;});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById(&quot;wp_editbtns&quot;)){tinymce.DOM.hide(&quot;wp_editbtns&quot;)}if(document.getElementById(&quot;wp_gallerybtns&quot;)){tinymce.DOM.hide(&quot;wp_gallerybtns&quot;)}clearTimeout(this.mceTout);this.mceTout=0},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,&quot;height&quot;,d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e='&lt;img src=&quot;'+d+'/img/trans.gif&quot; alt=&quot;$1&quot; class=&quot;mceWPmore mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_more_alt&quot;)+'&quot; /&gt;';b='&lt;img src=&quot;'+d+'/img/trans.gif&quot; class=&quot;mceWPnextpage mceItemNoResize&quot; title=&quot;'+c.getLang(&quot;wordpress.wp_page_alt&quot;)+'&quot; /&gt;';c.onInit.add(function(){c.dom.loadCSS(d+&quot;/css/content.css&quot;)});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName==&quot;IMG&quot;){if(c.dom.hasClass(g.node,&quot;mceWPmore&quot;)){g.name=&quot;wpmore&quot;}if(c.dom.hasClass(g.node,&quot;mceWPnextpage&quot;)){g.name=&quot;wppage&quot;}}})}});c.onBeforeSetContent.add(function(f,g){if(g.content){g.content=g.content.replace(/&lt;!--more(.*?)--&gt;/g,e);g.content=g.content.replace(/&lt;!--nextpage--&gt;/g,b)}});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/&lt;img[^&gt;]+&gt;/g,function(i){if(i.indexOf('class=&quot;mceWPmore')!==-1){var h,j=(h=i.match(/alt=&quot;(.*?)&quot;/))?h[1]:&quot;&quot;;i=&quot;&lt;!--more&quot;+j+&quot;--&gt;&quot;}if(i.indexOf('class=&quot;mceWPnextpage')!==-1){i=&quot;&lt;!--nextpage--&gt;&quot;}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive(&quot;wp_page&quot;,h.nodeName===&quot;IMG&quot;&amp;&amp;g.dom.hasClass(h,&quot;mceWPnextpage&quot;));f.setActive(&quot;wp_more&quot;,h.nodeName===&quot;IMG&quot;&amp;&amp;g.dom.hasClass(h,&quot;mceWPmore&quot;))})}});tinymce.PluginManager.add(&quot;wordpress&quot;,tinymce.plugins.WordPress)})();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjstinymcewptinymcejsgz"></a>
<div class="binary"><h4>Modified: trunk/wp-includes/js/tinymce/wp-tinymce.js.gz</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
</div>

</body>
</html>