mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Record undo checkpoint before deleting any selection.
This commit is contained in:
parent
797dbf46fb
commit
5b5d65f684
3 changed files with 9 additions and 1 deletions
|
@ -3102,6 +3102,10 @@ proto._onKey = function ( event ) {
|
|||
if ( keyHandlers[ key ] ) {
|
||||
keyHandlers[ key ]( this, event, range );
|
||||
} else if ( key.length === 1 && !range.collapsed ) {
|
||||
// Record undo checkpoint.
|
||||
this._recordUndoState( range );
|
||||
this._getRangeAndRemoveBookmark( range );
|
||||
// Delete the selection
|
||||
deleteContentsOfRange( range );
|
||||
this._ensureBottomLine();
|
||||
this.setSelection( range );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2026,6 +2026,10 @@ proto._onKey = function ( event ) {
|
|||
if ( keyHandlers[ key ] ) {
|
||||
keyHandlers[ key ]( this, event, range );
|
||||
} else if ( key.length === 1 && !range.collapsed ) {
|
||||
// Record undo checkpoint.
|
||||
this._recordUndoState( range );
|
||||
this._getRangeAndRemoveBookmark( range );
|
||||
// Delete the selection
|
||||
deleteContentsOfRange( range );
|
||||
this._ensureBottomLine();
|
||||
this.setSelection( range );
|
||||
|
|
Loading…
Reference in a new issue