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:
parent
ab24be4c87
commit
dced797c3f
|
@ -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 ) {
|
||||||
|
|
Loading…
Reference in New Issue