Make WordPress Core

Ticket #42530: 42530.diff

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

     
    635635                                selectionPosition = TinyMCEContentAreaTop + elementTop,
    636636                                visibleAreaHeight = windowHeight - ( edToolsHeight + toolbarHeight );
    637637
     638                        if ( selectionPosition < visibleAreaHeight ) {
     639                                return;
     640                        }
    638641                        /**
    639642                         * The minimum scroll height should be to the top of the editor, to offer a consistent
    640643                         * experience.
     
    854857                        if ( textArea.focus ) {
    855858                                // focus and scroll to the position
    856859                                setTimeout( function() {
     860                                        textArea.setSelectionRange( start, end );
    857861                                        if ( textArea.blur ) {
    858862                                                // defocus before focusing
    859863                                                textArea.blur();
    860864                                        }
    861865                                        textArea.focus();
    862866                                }, 100 );
    863 
    864                                 textArea.focus();
    865867                        }
    866 
    867                         textArea.setSelectionRange( start, end );
    868868                }
    869869
    870870                // Restore the selection when the editor is initialized. Needed when the Text editor is the default.