<!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" />
<title>[22007] trunk: Main editor: maintain the height when switching Visual to Text and back, save the height when resizing as user state, output the height in the textarea tag when loading, (thanks @nacin for the help), fixes #21718</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/22007">22007</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2012-09-26 03:30:21 +0000 (Wed, 26 Sep 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Main editor: maintain the height when switching Visual to Text and back, save the height when resizing as user state, output the height in the textarea tag when loading, (thanks @nacin for the help), fixes <a href="http://core.trac.wordpress.org/ticket/21718">#21718</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadminjseditorjs">trunk/wp-admin/js/editor.js</a></li>
<li><a href="#trunkwpadminjspostjs">trunk/wp-admin/js/post.js</a></li>
<li><a href="#trunkwpadminpressthisphp">trunk/wp-admin/press-this.php</a></li>
<li><a href="#trunkwpincludesclasswpeditorphp">trunk/wp-includes/class-wp-editor.php</a></li>
<li><a href="#trunkwpincludescsseditorcss">trunk/wp-includes/css/editor.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-admin/css/wp-admin.css        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -3107,7 +3107,7 @@
</span><span class="cx">         background: transparent url(../images/resize.gif) no-repeat scroll right bottom;
</span><span class="cx">         width: 12px;
</span><span class="cx">         cursor: se-resize;
</span><del>-        margin: 0 2px;
</del><ins>+        margin: 0 1px;
</ins><span class="cx">         position: relative;
</span><span class="cx">         top: -2px;
</span><span class="cx"> }
</span><span class="lines">@@ -3116,6 +3116,23 @@
</span><span class="cx">         top: 20px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#content-resize-handle {
+        background: transparent url(../images/resize.gif) no-repeat scroll right bottom;
+        width: 12px;
+        cursor: se-resize;
+        position: absolute;
+        right: 2px;
+        height: 19px;
+}
+
+.press-this #content-resize-handle {
+        bottom: 2px;
+}
+
+.tmce-active #content-resize-handle {
+        display: none;
+}
+
</ins><span class="cx"> #wp-word-count {
</span><span class="cx">         display: block;
</span><span class="cx">         padding: 2px 10px;
</span><span class="lines">@@ -4309,6 +4326,10 @@
</span><span class="cx">         box-shadow: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.comment-php .wp-editor-area {
+        height: 200px;
+}
+
</ins><span class="cx"> .comment-ays {
</span><span class="cx">         margin-bottom: 0;
</span><span class="cx">         border-style: solid;
</span><span class="lines">@@ -7320,6 +7341,7 @@
</span><span class="cx"> /* Editor/Main Column */
</span><span class="cx"> .press-this #poststuff {
</span><span class="cx">         margin: 0 10px 10px;
</span><ins>+        padding: 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #poststuff #editor-toolbar {
</span><span class="lines">@@ -7415,7 +7437,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .press-this #extra-fields .actions {
</span><del>-        margin: -25px -7px 0 0;
</del><ins>+        margin: -32px -7px 0 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .press-this .actions li {
</span><span class="lines">@@ -7515,7 +7537,7 @@
</span><span class="cx">         margin: 5px 0;
</span><span class="cx">         padding: 0 5px;
</span><span class="cx">         border: 0 none;
</span><del>-        height: 357px;
</del><ins>+        height: 345px;
</ins><span class="cx">         font-family: Consolas, Monaco, monospace;
</span><span class="cx">         font-size: 13px;
</span><span class="cx">         line-height: 19px;
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-admin/edit-form-advanced.php        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -347,7 +347,7 @@
</span><span class="cx"> ?&gt;
</span><span class="cx"> &lt;div id=&quot;postdivrich&quot; class=&quot;postarea&quot;&gt;
</span><span class="cx"> 
</span><del>-&lt;?php wp_editor($post-&gt;post_content, 'content', array('dfw' =&gt; true, 'tabfocus_elements' =&gt; 'sample-permalink,post-preview') ); ?&gt;
</del><ins>+&lt;?php wp_editor($post-&gt;post_content, 'content', array('dfw' =&gt; true, 'tabfocus_elements' =&gt; 'sample-permalink,post-preview', 'editor_height' =&gt; 360) ); ?&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;table id=&quot;post-status-info&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;
</span><span class="cx">         &lt;td id=&quot;wp-word-count&quot;&gt;&lt;?php printf( __( 'Word count: %s' ), '&lt;span class=&quot;word-count&quot;&gt;0&lt;/span&gt;' ); ?&gt;&lt;/td&gt;
</span></span></pre></div>
<a id="trunkwpadminjseditorjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/editor.js (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/editor.js        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-admin/js/editor.js        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -49,10 +49,8 @@
</span><span class="cx">                         if ( ed &amp;&amp; ed.isHidden() )
</span><span class="cx">                                 return false;
</span><span class="cx"> 
</span><del>-                        if ( ed ) {
-                                txtarea_el.style.height = ed.getContentAreaContainer().offsetHeight + 20 + 'px';
</del><ins>+                        if ( ed )
</ins><span class="cx">                                 ed.hide();
</span><del>-                        }
</del><span class="cx"> 
</span><span class="cx">                         dom.removeClass(wrap_id, 'tmce-active');
</span><span class="cx">                         dom.addClass(wrap_id, 'html-active');
</span></span></pre></div>
<a id="trunkwpadminjspostjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/post.js (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/post.js        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-admin/js/post.js        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -667,4 +667,83 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         wptitlehint();
</span><ins>+
+        // resizable textarea#content
+        (function() {
+                var textarea = $('textarea#content'), offset = null, el;
+
+                function dragging(e) {
+                        textarea.height( Math.max(50, offset + e.pageY) + 'px' );
+                        return false;
+                }
+
+                function endDrag(e) {
+                        var height = $('#wp-content-editor-container').height();
+
+                        textarea.focus();
+                        $(document).unbind('mousemove', dragging).unbind('mouseup', endDrag);
+
+                        if ( height &gt; 83 ) {
+                                height -= 33; // compensate for toolbars, padding...
+                                setUserSetting( 'ed_size', height );
+                        }
+                }
+
+                textarea.css('resize', 'none');
+                el = $('&lt;div id=&quot;content-resize-handle&quot;&gt;&lt;br&gt;&lt;/div&gt;');
+                $('#wp-content-wrap').append(el);
+                el.on('mousedown', function(e) {
+                        offset = textarea.height() - e.pageY;
+                        textarea.blur();
+                        $(document).mousemove(dragging).mouseup(endDrag);
+                        return false;
+                });
+        })();
+
+        tinymce.onAddEditor.add(function(mce, ed){
+                if ( ed.id != 'content' )
+                        return;
+
+                // resize TinyMCE to match the textarea height when switching Text -&gt; Visual
+                ed.onLoadContent.add( function(ed, o) {
+                        var ifr_height, height = parseInt( $('#content').css('height'), 10 ),
+                                tb_height = $('#content_tbl tr.mceFirst').height();
+
+                        if ( height &amp;&amp; !isNaN(height) &amp;&amp; tb_height ) {
+                                ifr_height = (height - tb_height) + 12; // compensate for padding in the textarea
+
+                                $('#content_tbl').css('height', '' );
+                                $('#content_ifr').css('height', ifr_height + 'px' );
+                                setUserSetting( 'ed_size', height );
+                        }
+                });
+
+                // resize the textarea to match TinyMCE's height when switching Visual -&gt; Text
+                ed.onSaveContent.add( function(ed, o) {
+                        var height = $('#content_tbl').height();
+
+                        if ( height &amp;&amp; height &gt; 83 ) {
+                                height -= 33;
+
+                                $('#content').css( 'height', height + 'px' );
+                                setUserSetting( 'ed_size', height );
+                        }
+                });
+
+                // save on resizing TinyMCE
+                ed.onPostRender.add(function() {
+                        $('#content_resize').on('mousedown.wp-mce-resize', function(e){
+                                $(document).on('mouseup.wp-mce-resize', function(e){
+                                        var height = $('#wp-content-editor-container').height();
+
+                                        height -= 33;
+                                        if ( height &gt; 50 &amp;&amp; height != getUserSetting( 'ed_size' ) )
+                                                setUserSetting( 'ed_size', height );
+
+                                        $(document).off('mouseup.wp-mce-resize');
+                                });
+                        });
+                });
+        });
+
</ins><span class="cx"> });
</span></span></pre></div>
<a id="trunkwpadminpressthisphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/press-this.php (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/press-this.php        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-admin/press-this.php        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                jQuery('#extra-fields').html('&lt;div class=&quot;postbox&quot;&gt;&lt;h2&gt;&lt;?php _e( 'Add Photos' ); ?&gt; &lt;small id=&quot;photo_directions&quot;&gt;(&lt;?php _e(&quot;click images to select&quot;) ?&gt;)&lt;/small&gt;&lt;/h2&gt;&lt;ul class=&quot;actions&quot;&gt;&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;photo-add-url&quot; class=&quot;button&quot;&gt;&lt;?php _e(&quot;Add from URL&quot;) ?&gt; +&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;inside&quot;&gt;&lt;div class=&quot;titlewrap&quot;&gt;&lt;div id=&quot;img_container&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;p id=&quot;options&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;close button&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;&lt;a href=&quot;#&quot; class=&quot;refresh button&quot;&gt;&lt;?php _e('Refresh'); ?&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;');
</del><ins>+                jQuery('#extra-fields').html('&lt;div class=&quot;postbox&quot;&gt;&lt;h2&gt;&lt;?php _e( 'Add Photos' ); ?&gt; &lt;small id=&quot;photo_directions&quot;&gt;(&lt;?php _e(&quot;click images to select&quot;) ?&gt;)&lt;/small&gt;&lt;/h2&gt;&lt;ul class=&quot;actions&quot;&gt;&lt;li&gt;&lt;a href=&quot;#&quot; id=&quot;photo-add-url&quot; class=&quot;button button-small&quot;&gt;&lt;?php _e(&quot;Add from URL&quot;) ?&gt; +&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;inside&quot;&gt;&lt;div class=&quot;titlewrap&quot;&gt;&lt;div id=&quot;img_container&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;p id=&quot;options&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;close button&quot;&gt;&lt;?php _e('Cancel'); ?&gt;&lt;/a&gt;&lt;a href=&quot;#&quot; class=&quot;refresh button&quot;&gt;&lt;?php _e('Refresh'); ?&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;');
</ins><span class="cx">                 jQuery('#img_container').html(strtoappend);
</span><span class="cx">                 &lt;?php break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludesclasswpeditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-editor.php (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-editor.php        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-includes/class-wp-editor.php        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">                         'wpautop' =&gt; true, // use wpautop?
</span><span class="cx">                         'media_buttons' =&gt; true, // show insert/upload button(s)
</span><span class="cx">                         'textarea_name' =&gt; $editor_id, // set the textarea name to something different, square brackets [] can be used here
</span><del>-                        'textarea_rows' =&gt; get_option('default_post_edit_rows', 10), // rows=&quot;...&quot;
</del><ins>+                        'textarea_rows' =&gt; 20,
</ins><span class="cx">                         'tabindex' =&gt; '',
</span><span class="cx">                         'tabfocus_elements' =&gt; ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE
</span><span class="cx">                         'editor_css' =&gt; '', // intended for extra styles for both visual and Text editors buttons, needs to include the &lt;style&gt; tags, can use &quot;scoped&quot;.
</span><span class="lines">@@ -52,6 +52,26 @@
</span><span class="cx">                 if ( self::$this_quicktags )
</span><span class="cx">                         self::$has_quicktags = true;
</span><span class="cx"> 
</span><ins>+                if ( empty( $set['editor_height'] ) )
+                        return $set;
+
+                if ( 'content' === $editor_id ) {
+                        // A cookie (set when a user resizes the editor) overrides the height.
+                        $cookie = (int) get_user_setting( 'ed_size' );
+
+                        // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
+                        if ( ! $cookie &amp;&amp; isset( $_COOKIE['TinyMCE_content_size'] ) ) {
+                                parse_str( $_COOKIE['TinyMCE_content_size'], $cookie );
+                                 $cookie = $cookie['ch'];
+                        }
+
+                        if ( $cookie )
+                                $set['editor_height'] = $cookie;
+                }
+
+                if ( $set['editor_height'] &lt; 50 )
+                        $set['editor_height'] = 50;
+
</ins><span class="cx">                 return $set;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -67,10 +87,14 @@
</span><span class="cx">                 $set = self::parse_settings($editor_id, $settings);
</span><span class="cx">                 $editor_class = ' class=&quot;' . trim( $set['editor_class'] . ' wp-editor-area' ) . '&quot;';
</span><span class="cx">                 $tabindex = $set['tabindex'] ? ' tabindex=&quot;' . (int) $set['tabindex'] . '&quot;' : '';
</span><del>-                $rows = ' rows=&quot;' . (int) $set['textarea_rows'] . '&quot;';
</del><span class="cx">                 $switch_class = 'html-active';
</span><span class="cx">                 $toolbar = $buttons = '';
</span><span class="cx"> 
</span><ins>+                if ( ! empty( $set['editor_height'] ) )
+                        $height = ' style=&quot;height: ' . $set['editor_height'] . 'px&quot;';
+                else
+                        $height = ' rows=&quot;' . $set['textarea_rows'] . '&quot;';
+
</ins><span class="cx">                 if ( !current_user_can( 'upload_files' ) )
</span><span class="cx">                         $set['media_buttons'] = false;
</span><span class="cx"> 
</span><span class="lines">@@ -116,7 +140,7 @@
</span><span class="cx">                         echo &quot;&lt;/div&gt;\n&quot;;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $the_editor = apply_filters('the_editor', '&lt;div id=&quot;wp-' . $editor_id . '-editor-container&quot; class=&quot;wp-editor-container&quot;&gt;&lt;textarea' . $editor_class . $rows . $tabindex . ' cols=&quot;40&quot; name=&quot;' . $set['textarea_name'] . '&quot; id=&quot;' . $editor_id . '&quot;&gt;%s&lt;/textarea&gt;&lt;/div&gt;');
</del><ins>+                $the_editor = apply_filters('the_editor', '&lt;div id=&quot;wp-' . $editor_id . '-editor-container&quot; class=&quot;wp-editor-container&quot;&gt;&lt;textarea' . $editor_class . $height . $tabindex . ' cols=&quot;40&quot; name=&quot;' . $set['textarea_name'] . '&quot; id=&quot;' . $editor_id . '&quot;&gt;%s&lt;/textarea&gt;&lt;/div&gt;');
</ins><span class="cx">                 $content = apply_filters('the_editor_content', $content);
</span><span class="cx"> 
</span><span class="cx">                 printf($the_editor, $content);
</span><span class="lines">@@ -403,6 +427,9 @@
</span><span class="cx">                                 'body_class' =&gt; $body_class
</span><span class="cx">                         );
</span><span class="cx"> 
</span><ins>+                        // The main editor doesn't use the TinyMCE resizing cookie.
+                        $mceInit['theme_advanced_resizing_use_cookie'] = 'content' !== $editor_id || empty( $set['editor_height'] );
+
</ins><span class="cx">                         if ( $first_run )
</span><span class="cx">                                 $mceInit = array_merge(self::$first_init, $mceInit);
</span><span class="cx"> 
</span><span class="lines">@@ -550,16 +577,26 @@
</span><span class="cx">                         else
</span><span class="cx">                                 echo &quot;&lt;script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'&gt;&lt;/script&gt;\n&quot;;
</span><span class="cx">                 }
</span><ins>+
+                $mce = ( self::$has_tinymce &amp;&amp; wp_default_editor() == 'tinymce' ) || ! self::$has_quicktags;
</ins><span class="cx"> ?&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;script type=&quot;text/javascript&quot;&gt;
</span><ins>+                var wpActiveEditor;
+
</ins><span class="cx">                 (function(){
</span><del>-                        var init, ed, qt, first_init, mce = &lt;?php echo wp_default_editor() == 'tinymce' ? 'true' : 'false'; ?&gt;;
</del><ins>+                        var init, ed, qt, first_init, DOM, el, i, mce = &lt;?php echo (int) $mce; ?&gt;;
</ins><span class="cx"> 
</span><span class="cx">                         if ( typeof(tinymce) == 'object' ) {
</span><ins>+                                DOM = tinymce.DOM;
</ins><span class="cx">                                 // mark wp_theme/ui.css as loaded
</span><del>-                                tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
</del><ins>+                                DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;
</ins><span class="cx"> 
</span><ins>+                                DOM.events.add( DOM.select('.wp-editor-wrap'), 'mousedown', function(e){
+                                        if ( this.id )
+                                                wpActiveEditor = this.id.slice(3, -5);
+                                });
+
</ins><span class="cx">                                 for ( ed in tinyMCEPreInit.mceInit ) {
</span><span class="cx">                                         if ( first_init ) {
</span><span class="cx">                                                 init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] );
</span><span class="lines">@@ -570,6 +607,12 @@
</span><span class="cx">                                         if ( mce )
</span><span class="cx">                                                 try { tinymce.init(init); } catch(e){}
</span><span class="cx">                                 }
</span><ins>+                        } else {
+                                el = document.getElementsByClassName('wp-editor-wrap');
+                                for ( i in el ) {
+                                        if ( typeof(el[i]) == 'object' )
+                                                el[i].onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); }
+                                }
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         if ( typeof(QTags) == 'function' ) {
</span><span class="lines">@@ -578,30 +621,24 @@
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 })();
</span><ins>+                &lt;?php
</ins><span class="cx"> 
</span><del>-                var wpActiveEditor;
-
-                jQuery('.wp-editor-wrap').mousedown(function(e){
-                        wpActiveEditor = this.id.slice(3, -5);
-                });
-
-&lt;?php
-
</del><span class="cx">                 if ( self::$ext_plugins )
</span><span class="cx">                         echo self::$ext_plugins . &quot;\n&quot;;
</span><span class="cx"> 
</span><span class="cx">                 if ( ! $compressed &amp;&amp; $tmce_on ) {
</span><del>-?&gt;
-                (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&amp;&amp;n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
-&lt;?php
</del><ins>+                        ?&gt;
+                        (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&amp;&amp;n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();
+                        &lt;?php
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( !is_admin() )
</span><span class="cx">                         echo 'var ajaxurl = &quot;' . admin_url( 'admin-ajax.php', 'relative' ) . '&quot;;';
</span><del>-?&gt;
-        &lt;/script&gt;
-&lt;?php
</del><span class="cx"> 
</span><ins>+                ?&gt;
+                &lt;/script&gt;
+                &lt;?php
+
</ins><span class="cx">                 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) )
</span><span class="cx">                         self::wp_link_dialog();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludescsseditorcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/editor.css (22006 => 22007)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/editor.css        2012-09-26 03:17:28 UTC (rev 22006)
+++ trunk/wp-includes/css/editor.css        2012-09-26 03:30:21 UTC (rev 22007)
</span><span class="lines">@@ -1018,12 +1018,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /* WP specific */
</span><ins>+.wp-editor-wrap {
+        position: relative;
+}
+
</ins><span class="cx"> .wp-editor-area {
</span><span class="cx">         font-family: Consolas, Monaco, monospace;
</span><span class="cx">         padding: 10px;
</span><ins>+        margin: 1px 0 0;
</ins><span class="cx">         line-height: 150%;
</span><span class="cx">         border: 0 none;
</span><span class="cx">         outline: none;
</span><ins>+        display: block;
</ins><span class="cx">         resize: vertical;
</span><span class="cx">         -moz-box-sizing: border-box;
</span><span class="cx">         -webkit-box-sizing: border-box;
</span></span></pre>
</div>
</div>

</body>
</html>