From 78b5ccd55ce5de8c38b6658c8952fa2474e53e26 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sun, 24 Aug 2014 23:11:03 +0000 Subject: [PATCH] Editor scrolling: fix window height when switching Visual to Text and the editor is shorter. Props mackensen, fixes #29226. git-svn-id: https://develop.svn.wordpress.org/trunk@29592 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/editor-expand.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wp-admin/js/editor-expand.js b/src/wp-admin/js/editor-expand.js index 6cd217f41c..593797b8ea 100644 --- a/src/wp-admin/js/editor-expand.js +++ b/src/wp-admin/js/editor-expand.js @@ -73,6 +73,11 @@ jQuery( document ).ready( function($) { statusBarHeight: $statusBar.outerHeight() || 0, sideSortablesHeight: $sideSortables.height() || 0 }; + + // Adjust for hidden + if ( heights.menuBarHeight < 3 ) { + heights.menuBarHeight = 0; + } } function textEditorKeyup( event ) { @@ -216,7 +221,14 @@ jQuery( document ).ready( function($) { } function mceHide() { + var wrapHeight = $( '#wpwrap' ).height(); + textEditorResize(); + + if ( wrapHeight && $window.scrollTop() > wrapHeight ) { + window.scrollTo( window.pageXOffset, wrapHeight - 1 ); + } + adjust(); }