mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Scroll cursor into view on enter.
This commit is contained in:
parent
ffe8d95cc1
commit
14ee0d0ad5
1 changed files with 11 additions and 1 deletions
|
@ -295,7 +295,7 @@
|
|||
undoStack, // = [],
|
||||
undoStackLength, // = 0,
|
||||
isInUndoState, // = false,
|
||||
docWasChanged = function docWasChanged () {
|
||||
docWasChanged = function () {
|
||||
if ( isInUndoState ) {
|
||||
isInUndoState = false;
|
||||
fireEvent( 'undoStateChange', {
|
||||
|
@ -1253,6 +1253,16 @@
|
|||
setSelection( createRange( nodeAfterSplit, 0 ) );
|
||||
updatePath( 0, true );
|
||||
|
||||
// Scroll into view
|
||||
if ( nodeAfterSplit.nodeType === TEXT_NODE ) {
|
||||
nodeAfterSplit = nodeAfterSplit.parentNode;
|
||||
}
|
||||
if ( nodeAfterSplit.offsetTop + nodeAfterSplit.offsetHeight >
|
||||
( doc.documentElement.scrollTop || body.scrollTop ) +
|
||||
body.offsetHeight ) {
|
||||
nodeAfterSplit.scrollIntoView( false );
|
||||
}
|
||||
|
||||
// We're not still in an undo state
|
||||
docWasChanged();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue