<!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>[29336] trunk/src: Editor scrolling:</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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/29336">29336</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-08-01 02:42:30 +0000 (Fri, 01 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Editor scrolling:
- Add a Screen Option to turn it on/off, and on()/off() methods from JS. Store the user preference.
- Fix delayed calls to resize() in the TinyMCE autoresize plugin.
See <a href="http://core.trac.wordpress.org/ticket/28328">#28328</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsseditcss">trunk/src/wp-admin/css/edit.css</a></li>
<li><a href="#trunksrcwpadmineditformadvancedphp">trunk/src/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunksrcwpadminincludesscreenphp">trunk/src/wp-admin/includes/screen.php</a></li>
<li><a href="#trunksrcwpadminjseditorexpandjs">trunk/src/wp-admin/js/editor-expand.js</a></li>
<li><a href="#trunksrcwpadminjspostjs">trunk/src/wp-admin/js/post.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginswpautoresizepluginjs">trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsseditcss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/edit.css (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/edit.css  2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-admin/css/edit.css     2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -355,12 +355,21 @@
</span><span class="cx"> #content-resize-handle {
</span><span class="cx">  background: transparent url(../images/resize.gif) no-repeat scroll right bottom;
</span><span class="cx">  width: 12px;
</span><ins>+       cursor: row-resize;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .rtl #content-resize-handle {
</span><span class="cx">  background: transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.wp-editor-expand #content-resize-handle {
+       display: none;
+}
+
+#postdivrich #content {
+       resize: none;
+}
+
</ins><span class="cx"> #wp-word-count {
</span><span class="cx">  display: block;
</span><span class="cx">  padding: 2px 10px;
</span></span></pre></div>
<a id="trunksrcwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/edit-form-advanced.php (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/edit-form-advanced.php        2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-admin/edit-form-advanced.php   2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -490,7 +490,7 @@
</span><span class="cx"> 
</span><span class="cx"> if ( post_type_supports($post_type, 'editor') ) {
</span><span class="cx"> ?>
</span><del>-<div id="postdivrich" class="postarea edit-form-section">
</del><ins>+<div id="postdivrich" class="postarea edit-form-section<?php if ( get_user_setting( 'editor_expand', 'on' ) === 'on' ) { echo ' wp-editor-expand'; } ?>">
</ins><span class="cx"> 
</span><span class="cx"> <?php wp_editor( $post->post_content, 'content', array(
</span><span class="cx">  'dfw' => true,
</span><span class="lines">@@ -499,7 +499,7 @@
</span><span class="cx">  'editor_height' => 360,
</span><span class="cx">  'tinymce' => array(
</span><span class="cx">          'resize' => false,
</span><del>-               'wp_autoresize_on' => ! empty( $_wp_autoresize_on ),
</del><ins>+                'wp_autoresize_on' => ( ! empty( $_wp_autoresize_on ) && get_user_setting( 'editor_expand', 'on' ) === 'on' ),
</ins><span class="cx">           'add_unload_trigger' => false,
</span><span class="cx">  ),
</span><span class="cx"> ) ); ?>
</span></span></pre></div>
<a id="trunksrcwpadminincludesscreenphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/screen.php (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/screen.php   2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-admin/includes/screen.php      2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -1110,6 +1110,11 @@
</span><span class="cx">                          <?php
</span><span class="cx">                  endfor; ?>
</span><span class="cx">          </div>
</span><ins>+               <div class="editor-expand hidden">
+                       <label for="editor-expand-toggle">
+                       <input type="checkbox" id="editor-expand-toggle" <?php checked( get_user_setting( 'editor_expand', 'on' ) === 'on' ); ?> />
+                       <?php _e( 'Expand the editor to match the window height.' ); ?></label>
+               </div>
</ins><span class="cx">           <?php
</span><span class="cx">  }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpadminjseditorexpandjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/editor-expand.js (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/editor-expand.js   2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-admin/js/editor-expand.js      2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx">  var $window = $( window ),
</span><span class="cx">          $document = $( document ),
</span><span class="cx">          $adminBar = $( '#wpadminbar' ),
</span><ins>+               $wrap = $( '#postdivrich' ),
</ins><span class="cx">           $contentWrap = $( '#wp-content-wrap' ),
</span><span class="cx">          $tools = $( '#wp-content-editor-tools' ),
</span><span class="cx">          $visualTop,
</span><span class="lines">@@ -15,18 +16,15 @@
</span><span class="cx">          $textEditorClone = $( '<div id="content-textarea-clone"></div>' ),
</span><span class="cx">          $bottom = $( '#post-status-info' ),
</span><span class="cx">          $statusBar,
</span><del>-               buffer = 200,
</del><span class="cx">           fullscreen = window.wp.editor && window.wp.editor.fullscreen,
</span><del>-               editorInstance,
</del><ins>+                mceEditor,
+               mceBind = function(){},
+               mceUnbind = function(){},
</ins><span class="cx">           fixedTop = false,
</span><span class="cx">          fixedBottom = false;
</span><span class="cx"> 
</span><span class="cx">  $textEditorClone.insertAfter( $textEditor );
</span><span class="cx"> 
</span><del>-       // use to enable/disable
-       $contentWrap.addClass( 'wp-editor-expand' );
-       $( '#content-resize-handle' ).hide();
-
</del><span class="cx">   $textEditorClone.css( {
</span><span class="cx">          'font-family': $textEditor.css( 'font-family' ),
</span><span class="cx">          'font-size': $textEditor.css( 'font-size' ),
</span><span class="lines">@@ -37,11 +35,7 @@
</span><span class="cx">          'word-wrap': 'break-word'
</span><span class="cx">  } );
</span><span class="cx"> 
</span><del>-       $textEditor.on( 'focus input propertychange', function() {
-               textEditorResize();
-       } );
-
-       $textEditor.on( 'keyup', function( event ) {
</del><ins>+        function textEditorKeyup( event ) {
</ins><span class="cx">           var VK = jQuery.ui.keyCode,
</span><span class="cx">                  key = event.keyCode,
</span><span class="cx">                  range = document.createRange(),
</span><span class="lines">@@ -78,10 +72,10 @@
</span><span class="cx">          } else if ( cursorBottom > editorBottom ) {
</span><span class="cx">                  window.scrollTo( window.pageXOffset, cursorBottom + window.pageYOffset - editorBottom );
</span><span class="cx">          }
</span><del>-       } );
</del><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">  function textEditorResize() {
</span><del>-               if ( editorInstance && ! editorInstance.isHidden() ) {
</del><ins>+                if ( mceEditor && ! mceEditor.isHidden() ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -114,7 +108,7 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // Copy the editor instance.
</span><del>-               editorInstance = editor;
</del><ins>+                mceEditor = editor;
</ins><span class="cx"> 
</span><span class="cx">          // Set the minimum height to the initial viewport height.
</span><span class="cx">          editor.settings.autoresize_min_height = 300;
</span><span class="lines">@@ -124,7 +118,7 @@
</span><span class="cx">          $visualEditor = $contentWrap.find( '.mce-edit-area' );
</span><span class="cx">          $statusBar = $contentWrap.find( '.mce-statusbar' ).filter( ':visible' );
</span><span class="cx"> 
</span><del>-               function getCursorOffset() {
</del><ins>+                function mceGetCursorOffset() {
</ins><span class="cx">                   var node = editor.selection.getNode(),
</span><span class="cx">                          view, offset;
</span><span class="cx"> 
</span><span class="lines">@@ -143,10 +137,10 @@
</span><span class="cx">          // Setting a buffer > 0 will prevent the browser default.
</span><span class="cx">          // Some browsers will scroll to the middle,
</span><span class="cx">          // others to the top/bottom of the *window* when moving the cursor out of the viewport.
</span><del>-               editor.on( 'keyup', function( event ) {
</del><ins>+                function mceKeyup( event ) {
</ins><span class="cx">                   var VK = tinymce.util.VK,
</span><span class="cx">                          key = event.keyCode,
</span><del>-                               offset = getCursorOffset(),
</del><ins>+                                offset = mceGetCursorOffset(),
</ins><span class="cx">                           windowHeight = $window.height(),
</span><span class="cx">                          buffer = 10,
</span><span class="cx">                          cursorTop, cursorBottom, editorTop, editorBottom;
</span><span class="lines">@@ -172,29 +166,41 @@
</span><span class="cx">                  } else if ( cursorBottom > editorBottom ) {
</span><span class="cx">                          window.scrollTo( window.pageXOffset, cursorBottom + window.pageYOffset - editorBottom );
</span><span class="cx">                  }
</span><del>-               } );
</del><ins>+                }
</ins><span class="cx"> 
</span><span class="cx">          // Adjust when switching editor modes.
</span><del>-               editor.on( 'show', function() {
</del><ins>+                function mceShow() {
</ins><span class="cx">                   setTimeout( function() {
</span><span class="cx">                          editor.execCommand( 'wpAutoResize' );
</span><span class="cx">                          adjust();
</span><span class="cx">                  }, 300 );
</span><del>-               } );
</del><ins>+                }
</ins><span class="cx"> 
</span><del>-               editor.on( 'hide', function() {
</del><ins>+                function mceHide() {
</ins><span class="cx">                   textEditorResize();
</span><span class="cx">                  adjust();
</span><del>-               } );
</del><ins>+                }
</ins><span class="cx"> 
</span><del>-               // Adjust when the editor resizes.
-               editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', function() {
-                       adjust();
-               } );
</del><ins>+                mceBind = function() {
+                       editor.on( 'keyup', mceKeyup );
+                       editor.on( 'show', mceShow );
+                       editor.on( 'hide', mceHide );
+                       // Adjust when the editor resizes.
+                       editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
+               };
</ins><span class="cx"> 
</span><del>-               // And adjust "immediately".
-               // Allow some time to load CSS etc.
-               initialResize( adjust );
</del><ins>+                mceUnbind = function() {
+                       editor.off( 'keyup', mceKeyup );
+                       editor.off( 'show', mceShow );
+                       editor.off( 'hide', mceHide );
+                       editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
+               };
+
+               if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
+                       // Adjust "immediately"
+                       mceBind();
+                       initialResize( adjust );
+               }
</ins><span class="cx">   } );
</span><span class="cx"> 
</span><span class="cx">  // Adjust the toolbars based on the active editor mode.
</span><span class="lines">@@ -210,7 +216,8 @@
</span><span class="cx">                  windowWidth = $window.width(),
</span><span class="cx">                  adminBarHeight = windowWidth > 600 ? $adminBar.height() : 0,
</span><span class="cx">                  resize = type !== 'scroll',
</span><del>-                       visual = ( editorInstance && ! editorInstance.isHidden() ),
</del><ins>+                        visual = ( mceEditor && ! mceEditor.isHidden() ),
+                       buffer = 200,
</ins><span class="cx">                   $top, $editor,
</span><span class="cx">                  toolsHeight, topPos, topHeight, editorPos, editorHeight, editorWidth, statusBarHeight;
</span><span class="cx"> 
</span><span class="lines">@@ -327,31 +334,132 @@
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       function fullscreenHide() {
+               textEditorResize();
+               adjust();
+       }
+
</ins><span class="cx">   function initialResize( callback ) {
</span><span class="cx">          for ( var i = 1; i < 6; i++ ) {
</span><span class="cx">                  setTimeout( callback, 500 * i );
</span><span class="cx">          }
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       // Adjust when the window is scrolled or resized.
-       $window.on( 'scroll.editor-expand resize.editor-expand', function( event ) {
-               adjust( event.type );
-       } );
</del><ins>+        function on() {
+               // Scroll to the top when triggering this from JS.
+               // Ensures toolbars are pinned properly.
+               if ( window.pageYOffset && window.pageYOffset > 130 ) {
+                       window.scrollTo( window.pageXOffset, 0 );
+               }
</ins><span class="cx"> 
</span><del>-       // Adjust when entering/exiting fullscreen mode.
-       fullscreen && fullscreen.pubsub.subscribe( 'hidden', function() {
-               textEditorResize();
-               adjust();
-       } );
</del><ins>+                $wrap.addClass( 'wp-editor-expand' );
</ins><span class="cx"> 
</span><del>-       // Adjust when collapsing the menu, changing the columns, changing the body class.
-       $document.on( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust );
</del><ins>+                // Adjust when the window is scrolled or resized.
+               $window.on( 'scroll.editor-expand resize.editor-expand', function( event ) {
+                       adjust( event.type );
+               } );
</ins><span class="cx"> 
</span><del>-       // Ideally we need to resize just after CSS has fully loaded and QuickTags is ready.
-       if ( $contentWrap.hasClass( 'html-active' ) ) {
-               initialResize( function() {
-                       adjust();
</del><ins>+                // Adjust when collapsing the menu, changing the columns, changing the body class.
+               $document.on( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust );
+
+               $textEditor.on( 'focus.editor-expand input.editor-expand propertychange.editor-expand', textEditorResize );
+               $textEditor.on( 'keyup.editor-expand', textEditorKeyup );
+               mceBind();
+
+               // Adjust when entering/exiting fullscreen mode.
+               fullscreen && fullscreen.pubsub.subscribe( 'hidden', fullscreenHide );
+
+               if ( mceEditor ) {
+                       mceEditor.settings.wp_autoresize_on = true;
+                       mceEditor.execCommand( 'wpAutoResizeOn' );
+
+                       if ( ! mceEditor.isHidden() ) {
+                               mceEditor.execCommand( 'wpAutoResize' );
+                       }
+               }
+
+               if ( ! mceEditor || mceEditor.isHidden() ) {
</ins><span class="cx">                   textEditorResize();
</span><del>-               } );
</del><ins>+                }
+
+               adjust();
</ins><span class="cx">   }
</span><ins>+
+       function off() {
+               var height = window.getUserSetting('ed_size');
+
+               // Scroll to the top when triggering this from JS.
+               // Ensures toolbars are reset properly.
+               if ( window.pageYOffset && window.pageYOffset > 130 ) {
+                       window.scrollTo( window.pageXOffset, 0 );
+               }
+
+               $wrap.removeClass( 'wp-editor-expand' );
+
+               // Adjust when the window is scrolled or resized.
+               $window.off( 'scroll.editor-expand resize.editor-expand' );
+
+               // Adjust when collapsing the menu, changing the columns, changing the body class.
+               $document.off( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust );
+
+               $textEditor.off( 'focus.editor-expand input.editor-expand propertychange.editor-expand', textEditorResize );
+               $textEditor.off( 'keyup.editor-expand', textEditorKeyup );
+               mceUnbind();
+
+               // Adjust when entering/exiting fullscreen mode.
+               fullscreen && fullscreen.pubsub.unsubscribe( 'hidden', fullscreenHide );
+
+               // Reset all css
+               $.each( [ $visualTop, $textTop, $tools, $bottom, $contentWrap, $visualEditor, $textEditor ], function( i, element ) {
+                       element && element.attr( 'style', '' );
+               });
+
+               if ( mceEditor ) {
+                       mceEditor.settings.wp_autoresize_on = false;
+                       mceEditor.execCommand( 'wpAutoResizeOff' );
+
+                       if ( ! mceEditor.isHidden() ) {
+                               $textEditor.hide();
+
+                               if ( height ) {
+                                       mceEditor.theme.resizeTo( null, height );
+                               }
+                       }
+               }
+
+               if ( height ) {
+                       $textEditor.height( height );
+               }
+       }
+
+       // Start on load
+       if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
+               on();
+
+               // Ideally we need to resize just after CSS has fully loaded and QuickTags is ready.
+               if ( $contentWrap.hasClass( 'html-active' ) ) {
+                       initialResize( function() {
+                               adjust();
+                               textEditorResize();
+                       } );
+               }
+       }
+
+       // Show the on/off checkbox
+       $( '#adv-settings .editor-expand' ).show();
+       $( '#editor-expand-toggle' ).on( 'change.editor-expand', function() {
+               if ( $(this).prop( 'checked' ) ) {
+                       on();
+                       window.setUserSetting( 'editor_expand', 'on' );
+               } else {
+                       off();
+                       window.setUserSetting( 'editor_expand', 'off' );
+               }
+       });
+
+       // Expose on() and off()
+       window.editorExpand = {
+               on: on,
+               off: off
+       };
</ins><span class="cx"> });
</span></span></pre></div>
<a id="trunksrcwpadminjspostjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/post.js (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/post.js    2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-admin/js/post.js       2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -1005,7 +1005,7 @@
</span><span class="cx">          var editor, offset, mce,
</span><span class="cx">                  $textarea = $('textarea#content'),
</span><span class="cx">                  $handle = $('#post-status-info'),
</span><del>-                       $contentWrap = $('#wp-content-wrap');
</del><ins>+                        $postdivrich = $('#postdivrich');
</ins><span class="cx"> 
</span><span class="cx">          // No point for touch devices
</span><span class="cx">          if ( ! $textarea.length || 'ontouchstart' in window ) {
</span><span class="lines">@@ -1015,7 +1015,7 @@
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          function dragging( event ) {
</span><del>-                       if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
</del><ins>+                        if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) {
</ins><span class="cx">                           return;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -1031,7 +1031,7 @@
</span><span class="cx">          function endDrag() {
</span><span class="cx">                  var height, toolbarHeight;
</span><span class="cx"> 
</span><del>-                       if ( $contentWrap.hasClass( 'wp-editor-expand' ) ) {
</del><ins>+                        if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) {
</ins><span class="cx">                           return;
</span><span class="cx">                  }
</span><span class="cx"> 
</span><span class="lines">@@ -1057,8 +1057,6 @@
</span><span class="cx">                  }
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               $textarea.css( 'resize', 'none' );
-
</del><span class="cx">           $handle.on( 'mousedown.wp-editor-resize', function( event ) {
</span><span class="cx">                  if ( typeof tinymce !== 'undefined' ) {
</span><span class="cx">                          editor = tinymce.get('content');
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginswpautoresizepluginjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js (29335 => 29336)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js  2014-08-01 02:03:13 UTC (rev 29335)
+++ trunk/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js     2014-08-01 02:42:30 UTC (rev 29336)
</span><span class="lines">@@ -21,7 +21,9 @@
</span><span class="cx">  * it's initialized.
</span><span class="cx">  */
</span><span class="cx"> tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
</span><del>-       var settings = editor.settings, oldSize = 0;
</del><ins>+        var settings = editor.settings,
+               oldSize = 0,
+               isActive = false;
</ins><span class="cx"> 
</span><span class="cx">  function isFullscreen() {
</span><span class="cx">          return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
</span><span class="lines">@@ -37,8 +39,12 @@
</span><span class="cx">  function resize( e ) {
</span><span class="cx">          var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight, marginTop, marginBottom;
</span><span class="cx"> 
</span><ins>+               if ( ! isActive ) {
+                       return;
+               }
+
</ins><span class="cx">           doc = editor.getDoc();
</span><del>-               if (!doc) {
</del><ins>+                if ( ! doc ) {
</ins><span class="cx">                   return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -128,6 +134,7 @@
</span><span class="cx"> 
</span><span class="cx">  function on() {
</span><span class="cx">          if ( ! editor.dom.hasClass( editor.getBody(), 'wp-autoresize' ) ) {
</span><ins>+                       isActive = true;
</ins><span class="cx">                   editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
</span><span class="cx">                  // Add appropriate listeners for resizing the content area
</span><span class="cx">                  editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize );
</span><span class="lines">@@ -140,6 +147,7 @@
</span><span class="cx"> 
</span><span class="cx">          // Don't turn off if the setting is 'on'
</span><span class="cx">          if ( ! settings.wp_autoresize_on ) {
</span><ins>+                       isActive = false;
</ins><span class="cx">                   doc = editor.getDoc();
</span><span class="cx">                  editor.dom.removeClass( editor.getBody(), 'wp-autoresize' );
</span><span class="cx">                  editor.off( 'nodechange setcontent keyup FullscreenStateChanged', resize );
</span><span class="lines">@@ -151,6 +159,8 @@
</span><span class="cx"> 
</span><span class="cx">  if ( settings.wp_autoresize_on ) {
</span><span class="cx">          // Turn resizing on when the editor loads
</span><ins>+               isActive = true;
+
</ins><span class="cx">           editor.on( 'init', function() {
</span><span class="cx">                  editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
</span><span class="cx">          });
</span><span class="lines">@@ -163,7 +173,7 @@
</span><span class="cx"> 
</span><span class="cx">          if ( editor.getParam( 'autoresize_on_init', true ) ) {
</span><span class="cx">                  editor.on( 'init', function() {
</span><del>-                               // Hit it 20 times in 100 ms intervals
</del><ins>+                                // Hit it 10 times in 200 ms intervals
</ins><span class="cx">                           wait( 10, 200, function() {
</span><span class="cx">                                  // Hit it 5 times in 1 sec intervals
</span><span class="cx">                                  wait( 5, 1000 );
</span></span></pre>
</div>
</div>

</body>
</html>