From 96daabb134f82dfc1f0460f947b11b4d44f58724 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 1 Aug 2014 21:42:03 +0000 Subject: [PATCH] Editor scrolling: run one more adjust() 200ms after scroll or resize in case the browser is slow to re-calculate the element heights and pin/unpin the toolbars. See #28328, fixes #29059. git-svn-id: https://develop.svn.wordpress.org/trunk@29352 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/editor-expand.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/js/editor-expand.js b/src/wp-admin/js/editor-expand.js index 9129366e99..62c050675f 100644 --- a/src/wp-admin/js/editor-expand.js +++ b/src/wp-admin/js/editor-expand.js @@ -21,7 +21,8 @@ jQuery( document ).ready( function($) { mceBind = function(){}, mceUnbind = function(){}, fixedTop = false, - fixedBottom = false; + fixedBottom = false, + scrollTimer; $textEditorClone.insertAfter( $textEditor ); @@ -345,6 +346,11 @@ jQuery( document ).ready( function($) { } } + function afterScroll() { + clearTimeout( scrollTimer ); + scrollTimer = setTimeout( adjust, 200 ); + } + function on() { // Scroll to the top when triggering this from JS. // Ensures toolbars are pinned properly. @@ -357,6 +363,7 @@ jQuery( document ).ready( function($) { // Adjust when the window is scrolled or resized. $window.on( 'scroll.editor-expand resize.editor-expand', function( event ) { adjust( event.type ); + afterScroll(); } ); // Adjust when collapsing the menu, changing the columns, changing the body class.