Ticket #29349: 29349.patch
File 29349.patch, 3.6 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
33 33 lastScrollPosition = 0, 34 34 pageYOffsetAtTop = 130, 35 35 pinnedToolsTop = 56, 36 sidebarBottom = 20, 36 37 autoresizeMinHeight = 300, 37 38 initialMode = window.getUserSetting( 'editor' ), 38 39 // These are corrected when adjust() runs, except on scrolling if already set. … … 432 433 $document.height() > ( $sideSortables.height() + postBodyTop + 120 ) && // the sidebar is not the tallest element 433 434 heights.windowHeight < editorHeight ) { // the editor is taller than the viewport 434 435 435 if ( heights.sideSortablesHeight> heights.windowHeight || fixedSideTop || fixedSideBottom ) {436 if ( ( heights.sideSortablesHeight + pinnedToolsTop + sidebarBottom ) > heights.windowHeight || fixedSideTop || fixedSideBottom ) { 436 437 // Reset when scrolling to the top 437 438 if ( windowPos + pinnedToolsTop <= postBodyTop ) { 438 439 $sideSortables.attr( 'style', '' ); … … 447 448 footerTop = $footer.offset().top; 448 449 449 450 // don't get over the footer 450 if ( footerTop < sidebarTop + heights.sideSortablesHeight + 20) {451 sidebarTop = footerTop - heights.sideSortablesHeight - 20;451 if ( footerTop < sidebarTop + heights.sideSortablesHeight + sidebarBottom ) { 452 sidebarTop = footerTop - heights.sideSortablesHeight - 12; 452 453 } 453 454 454 455 $sideSortables.css({ … … 456 457 top: sidebarTop, 457 458 bottom: '' 458 459 }); 459 } else if ( ! fixedSideBottom && heights.sideSortablesHeight + $sideSortables.offset().top + 20< windowPos + heights.windowHeight ) {460 } else if ( ! fixedSideBottom && heights.sideSortablesHeight + $sideSortables.offset().top + sidebarBottom < windowPos + heights.windowHeight ) { 460 461 // pin the bottom 461 462 fixedSideBottom = true; 462 463 … … 463 464 $sideSortables.css({ 464 465 position: 'fixed', 465 466 top: 'auto', 466 bottom: '20px'467 bottom: sidebarBottom 467 468 }); 468 469 } 469 470 } else if ( windowPos < lastScrollPosition ) { … … 471 472 if ( fixedSideBottom ) { 472 473 // let it scroll 473 474 fixedSideBottom = false; 474 sidebarTop = $sideSortables.offset().top - 20;475 sidebarTop = $sideSortables.offset().top - sidebarBottom; 475 476 footerTop = $footer.offset().top; 476 477 477 478 // don't get over the footer 478 if ( footerTop < sidebarTop + heights.sideSortablesHeight + 20) {479 sidebarTop = footerTop - heights.sideSortablesHeight - 20;479 if ( footerTop < sidebarTop + heights.sideSortablesHeight + sidebarBottom ) { 480 sidebarTop = footerTop - heights.sideSortablesHeight - 12; 480 481 } 481 482 482 483 $sideSortables.css({ … … 499 500 } else { 500 501 // if the sidebar container is smaller than the viewport, then pin/unpin the top when scrolling 501 502 if ( windowPos >= ( postBodyTop - pinnedToolsTop ) ) { 503 502 504 $sideSortables.css( { 503 505 position: 'fixed', 504 506 top: pinnedToolsTop … … 569 571 // Adjust when collapsing the menu, changing the columns, changing the body class. 570 572 $document.on( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust ) 571 573 .on( 'postbox-toggled.editor-expand', function() { 572 if ( ! fixedSideTop && ! fixedSideBottom && window.pageYOffset > 20) {574 if ( ! fixedSideTop && ! fixedSideBottom && window.pageYOffset > pinnedToolsTop ) { 573 575 fixedSideBottom = true; 574 576 window.scrollBy( 0, -1 ); 575 577 adjust();