mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 23:40:35 -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, // = [],
|
undoStack, // = [],
|
||||||
undoStackLength, // = 0,
|
undoStackLength, // = 0,
|
||||||
isInUndoState, // = false,
|
isInUndoState, // = false,
|
||||||
docWasChanged = function docWasChanged () {
|
docWasChanged = function () {
|
||||||
if ( isInUndoState ) {
|
if ( isInUndoState ) {
|
||||||
isInUndoState = false;
|
isInUndoState = false;
|
||||||
fireEvent( 'undoStateChange', {
|
fireEvent( 'undoStateChange', {
|
||||||
|
@ -1253,6 +1253,16 @@
|
||||||
setSelection( createRange( nodeAfterSplit, 0 ) );
|
setSelection( createRange( nodeAfterSplit, 0 ) );
|
||||||
updatePath( 0, true );
|
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
|
// We're not still in an undo state
|
||||||
docWasChanged();
|
docWasChanged();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue