From dced797c3f496c879018cfe15ae6e21bb38a0659 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 17 Sep 2017 03:34:47 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/code-editor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/code-editor.js b/src/wp-admin/js/code-editor.js index 61891d32bb..e2f187c15f 100644 --- a/src/wp-admin/js/code-editor.js +++ b/src/wp-admin/js/code-editor.js @@ -181,10 +181,10 @@ if ( 'undefined' === typeof window.wp.codeEditor ) { $textarea.data( 'next-tab-blurs', false ); }); codemirror.on( 'focus', function() { - if ( codemirror.display.wrapper.scrollIntoViewIfNeeded ) { - codemirror.display.wrapper.scrollIntoViewIfNeeded(); + if ( codemirror.display.cursorDiv.scrollIntoViewIfNeeded ) { + codemirror.display.cursorDiv.scrollIntoViewIfNeeded(); } else { - codemirror.display.wrapper.scrollIntoView(); + codemirror.display.cursorDiv.scrollIntoView(); } }); codemirror.on( 'keydown', function onKeydown( editor, event ) {