Make WordPress Core

Ticket #42530: 42530.3.diff

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

     
    270270                        if ( shortcodes ) {
    271271                                for ( var i = 0; i < shortcodes.length; i++ ) {
    272272                                        var shortcode = shortcodes[ i ].replace( /^\[+/g, '' );
    273        
     273
    274274                                        if ( result.indexOf( shortcode ) === -1 ) {
    275275                                                result.push( shortcode );
    276276                                        }
     
    581581
    582582                        removeSelectionMarker( startNode );
    583583                        removeSelectionMarker( endNode );
     584
     585                        editor.save();
    584586                }
    585587
    586588                /**
     
    623625
    624626                                edTools = $( '#wp-content-editor-tools' ),
    625627                                edToolsHeight = 0,
    626                                 edToolsOffsetTop = 0;
     628                                edToolsOffsetTop = 0,
     629
     630                                $scrollArea;
    627631
    628632                        if ( edTools.length ) {
    629633                                edToolsHeight = edTools.height();
     
    648652                         * subtracting the height. This gives the scroll position where the top of the editor tools aligns with
    649653                         * the top of the viewport (under the Master Bar)
    650654                         */
    651                         var adjustedScroll = Math.max( selectionPosition - visibleAreaHeight / 2, edToolsOffsetTop - edToolsHeight );
     655                        var adjustedScroll;
     656                        if ( editor.settings.wp_autoresize_on ) {
     657                                $scrollArea = $( 'html,body' );
     658                                adjustedScroll = Math.max( selectionPosition - visibleAreaHeight / 2, edToolsOffsetTop - edToolsHeight );
     659                        } else {
     660                                $scrollArea = $( editor.contentDocument ).find( 'html,body' );
     661                                adjustedScroll = elementTop;
     662                        }
    652663
    653                         $( 'html,body' ).animate( {
     664                        $scrollArea.animate( {
    654665                                scrollTop: parseInt( adjustedScroll, 10 )
    655666                        }, 100 );
    656667                }