mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 13:16:31 -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 ] ) {
|
if ( keyHandlers[ key ] ) {
|
||||||
keyHandlers[ key ]( this, event, range );
|
keyHandlers[ key ]( this, event, range );
|
||||||
} else if ( key.length === 1 && !range.collapsed ) {
|
} else if ( key.length === 1 && !range.collapsed ) {
|
||||||
|
// Record undo checkpoint.
|
||||||
|
this._recordUndoState( range );
|
||||||
|
this._getRangeAndRemoveBookmark( range );
|
||||||
|
// Delete the selection
|
||||||
deleteContentsOfRange( range );
|
deleteContentsOfRange( range );
|
||||||
this._ensureBottomLine();
|
this._ensureBottomLine();
|
||||||
this.setSelection( range );
|
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 ] ) {
|
if ( keyHandlers[ key ] ) {
|
||||||
keyHandlers[ key ]( this, event, range );
|
keyHandlers[ key ]( this, event, range );
|
||||||
} else if ( key.length === 1 && !range.collapsed ) {
|
} else if ( key.length === 1 && !range.collapsed ) {
|
||||||
|
// Record undo checkpoint.
|
||||||
|
this._recordUndoState( range );
|
||||||
|
this._getRangeAndRemoveBookmark( range );
|
||||||
|
// Delete the selection
|
||||||
deleteContentsOfRange( range );
|
deleteContentsOfRange( range );
|
||||||
this._ensureBottomLine();
|
this._ensureBottomLine();
|
||||||
this.setSelection( range );
|
this.setSelection( range );
|
||||||
|
|
Loading…
Reference in a new issue