Skip to content

Commit

Permalink
Editor scrolling: run one more adjust() 200ms after scroll or resize …
Browse files Browse the repository at this point in the history
…in case the browser is slow to re-calculate the element heights and pin/unpin the toolbars. See #28328, fixes #29059.

Built from https://develop.svn.wordpress.org/trunk@29352


git-svn-id: http://core.svn.wordpress.org/trunk@29128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed Aug 1, 2014
1 parent 9a9b179 commit e50ffd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion wp-admin/js/editor-expand.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jQuery( document ).ready( function($) {
mceBind = function(){},
mceUnbind = function(){},
fixedTop = false,
fixedBottom = false;
fixedBottom = false,
scrollTimer;

$textEditorClone.insertAfter( $textEditor );

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/editor-expand.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e50ffd4

Please sign in to comment.