0
Fork 0
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:
Neil Jenkins 2014-12-26 20:04:42 +07:00
parent 797dbf46fb
commit 5b5d65f684
3 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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 );