Code Editor: Scroll the cursor line into view instead of the entire editor when focused.

See #41850.
Fixes #41879.


git-svn-id: https://develop.svn.wordpress.org/trunk@41384 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-09-17 03:34:47 +00:00
parent ab24be4c87
commit dced797c3f
1 changed files with 3 additions and 3 deletions

View File

@ -181,10 +181,10 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
$textarea.data( 'next-tab-blurs', false ); $textarea.data( 'next-tab-blurs', false );
}); });
codemirror.on( 'focus', function() { codemirror.on( 'focus', function() {
if ( codemirror.display.wrapper.scrollIntoViewIfNeeded ) { if ( codemirror.display.cursorDiv.scrollIntoViewIfNeeded ) {
codemirror.display.wrapper.scrollIntoViewIfNeeded(); codemirror.display.cursorDiv.scrollIntoViewIfNeeded();
} else { } else {
codemirror.display.wrapper.scrollIntoView(); codemirror.display.cursorDiv.scrollIntoView();
} }
}); });
codemirror.on( 'keydown', function onKeydown( editor, event ) { codemirror.on( 'keydown', function onKeydown( editor, event ) {