Make WordPress Core

Ticket #42530: 42530.2.diff

File 42530.2.diff, 1.2 KB (added by pento, 7 years ago)
  • src/wp-admin/js/editor.js

     
    623623
    624624                                edTools = $( '#wp-content-editor-tools' ),
    625625                                edToolsHeight = 0,
    626                                 edToolsOffsetTop = 0;
     626                                edToolsOffsetTop = 0,
     627                               
     628                                $scrollArea;
    627629
    628630                        if ( edTools.length ) {
    629631                                edToolsHeight = edTools.height();
     
    648650                         * subtracting the height. This gives the scroll position where the top of the editor tools aligns with
    649651                         * the top of the viewport (under the Master Bar)
    650652                         */
    651                         var adjustedScroll = Math.max( selectionPosition - visibleAreaHeight / 2, edToolsOffsetTop - edToolsHeight );
     653                        var adjustedScroll;
     654                        if ( editor.settings.wp_autoresize_on ) {
     655                                $scrollArea = $( 'html,body' );
     656                                adjustedScroll = Math.max( selectionPosition - visibleAreaHeight / 2, edToolsOffsetTop - edToolsHeight );
     657                        } else {
     658                                $scrollArea = $( editor.contentDocument ).find( 'html,body' );
     659                                adjustedScroll = elementTop;
     660                        }
    652661
    653                         $( 'html,body' ).animate( {
     662                        $scrollArea.animate( {
    654663                                scrollTop: parseInt( adjustedScroll, 10 )
    655664                        }, 100 );
    656665                }