Editor expand: revert back to scrolling to the editor top when switching Visual to Text, fixes #29338

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


git-svn-id: http://core.svn.wordpress.org/trunk@29473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-09-03 18:04:16 +00:00
parent 0eaa3d9088
commit 86373f3a4b
2 changed files with 3 additions and 17 deletions

View File

@ -31,8 +31,6 @@ jQuery( document ).ready( function($) {
fixedSideBottom = false, fixedSideBottom = false,
scrollTimer, scrollTimer,
lastScrollPosition = 0, lastScrollPosition = 0,
visualEditorScrollPosition = 0,
textEditorScrollPosition = 0,
pageYOffsetAtTop = 130, pageYOffsetAtTop = 130,
pinnedToolsTop = 56, pinnedToolsTop = 56,
sidebarBottom = 20, sidebarBottom = 20,
@ -226,30 +224,18 @@ jQuery( document ).ready( function($) {
// Adjust when switching editor modes. // Adjust when switching editor modes.
function mceShow() { function mceShow() {
textEditorScrollPosition = window.pageYOffset;
setTimeout( function() { setTimeout( function() {
var top = $contentWrap.offset().top;
if ( window.pageYOffset > top || visualEditorScrollPosition ) {
window.scrollTo( window.pageXOffset, visualEditorScrollPosition ? visualEditorScrollPosition : top - heights.adminBarHeight );
}
editor.execCommand( 'wpAutoResize' ); editor.execCommand( 'wpAutoResize' );
adjust(); adjust();
}, 300 ); }, 300 );
adjust();
} }
function mceHide() { function mceHide() {
visualEditorScrollPosition = window.pageYOffset;
setTimeout( function() { setTimeout( function() {
var top = $contentWrap.offset().top; var top = $contentWrap.offset().top;
if ( window.pageYOffset > top || textEditorScrollPosition ) { if ( window.pageYOffset > top ) {
window.scrollTo( window.pageXOffset, textEditorScrollPosition ? textEditorScrollPosition : top - heights.adminBarHeight ); window.scrollTo( window.pageXOffset, top - heights.adminBarHeight );
} }
textEditorResize(); textEditorResize();

File diff suppressed because one or more lines are too long