mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Fix broken this
reference in afterCut handler.
This commit is contained in:
parent
f918a0106b
commit
5d30a85aa8
3 changed files with 20 additions and 22 deletions
|
@ -2445,22 +2445,21 @@ var cleanupBRs = function ( root ) {
|
||||||
|
|
||||||
// --- Cut and Paste ---
|
// --- Cut and Paste ---
|
||||||
|
|
||||||
var afterCut = function ( self ) {
|
|
||||||
try {
|
|
||||||
// If all content removed, ensure div at start of body.
|
|
||||||
fixCursor( self._body );
|
|
||||||
} catch ( error ) {
|
|
||||||
self.didError( error );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
proto._onCut = function () {
|
proto._onCut = function () {
|
||||||
// Save undo checkpoint
|
// Save undo checkpoint
|
||||||
var range = this.getSelection();
|
var range = this.getSelection();
|
||||||
|
var self = this;
|
||||||
this._recordUndoState( range );
|
this._recordUndoState( range );
|
||||||
this._getRangeAndRemoveBookmark( range );
|
this._getRangeAndRemoveBookmark( range );
|
||||||
this.setSelection( range );
|
this.setSelection( range );
|
||||||
setTimeout( function () { afterCut( this ); }, 0 );
|
setTimeout( function () {
|
||||||
|
try {
|
||||||
|
// If all content removed, ensure div at start of body.
|
||||||
|
fixCursor( self._body );
|
||||||
|
} catch ( error ) {
|
||||||
|
self.didError( error );
|
||||||
|
}
|
||||||
|
}, 0 );
|
||||||
};
|
};
|
||||||
|
|
||||||
proto._onPaste = function ( event ) {
|
proto._onPaste = function ( event ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1398,22 +1398,21 @@ var cleanupBRs = function ( root ) {
|
||||||
|
|
||||||
// --- Cut and Paste ---
|
// --- Cut and Paste ---
|
||||||
|
|
||||||
var afterCut = function ( self ) {
|
|
||||||
try {
|
|
||||||
// If all content removed, ensure div at start of body.
|
|
||||||
fixCursor( self._body );
|
|
||||||
} catch ( error ) {
|
|
||||||
self.didError( error );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
proto._onCut = function () {
|
proto._onCut = function () {
|
||||||
// Save undo checkpoint
|
// Save undo checkpoint
|
||||||
var range = this.getSelection();
|
var range = this.getSelection();
|
||||||
|
var self = this;
|
||||||
this._recordUndoState( range );
|
this._recordUndoState( range );
|
||||||
this._getRangeAndRemoveBookmark( range );
|
this._getRangeAndRemoveBookmark( range );
|
||||||
this.setSelection( range );
|
this.setSelection( range );
|
||||||
setTimeout( function () { afterCut( this ); }, 0 );
|
setTimeout( function () {
|
||||||
|
try {
|
||||||
|
// If all content removed, ensure div at start of body.
|
||||||
|
fixCursor( self._body );
|
||||||
|
} catch ( error ) {
|
||||||
|
self.didError( error );
|
||||||
|
}
|
||||||
|
}, 0 );
|
||||||
};
|
};
|
||||||
|
|
||||||
proto._onPaste = function ( event ) {
|
proto._onPaste = function ( event ) {
|
||||||
|
|
Loading…
Reference in a new issue