mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 23:40:35 -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 ) {
|
proto._onCut = function () {
|
||||||
|
// Save undo checkpoint
|
||||||
|
var range = this.getSelection();
|
||||||
|
var self = this;
|
||||||
|
this._recordUndoState( range );
|
||||||
|
this._getRangeAndRemoveBookmark( range );
|
||||||
|
this.setSelection( range );
|
||||||
|
setTimeout( function () {
|
||||||
try {
|
try {
|
||||||
// If all content removed, ensure div at start of body.
|
// If all content removed, ensure div at start of body.
|
||||||
fixCursor( self._body );
|
fixCursor( self._body );
|
||||||
} catch ( error ) {
|
} catch ( error ) {
|
||||||
self.didError( error );
|
self.didError( error );
|
||||||
}
|
}
|
||||||
};
|
}, 0 );
|
||||||
|
|
||||||
proto._onCut = function () {
|
|
||||||
// Save undo checkpoint
|
|
||||||
var range = this.getSelection();
|
|
||||||
this._recordUndoState( range );
|
|
||||||
this._getRangeAndRemoveBookmark( range );
|
|
||||||
this.setSelection( range );
|
|
||||||
setTimeout( function () { afterCut( this ); }, 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 ) {
|
proto._onCut = function () {
|
||||||
|
// Save undo checkpoint
|
||||||
|
var range = this.getSelection();
|
||||||
|
var self = this;
|
||||||
|
this._recordUndoState( range );
|
||||||
|
this._getRangeAndRemoveBookmark( range );
|
||||||
|
this.setSelection( range );
|
||||||
|
setTimeout( function () {
|
||||||
try {
|
try {
|
||||||
// If all content removed, ensure div at start of body.
|
// If all content removed, ensure div at start of body.
|
||||||
fixCursor( self._body );
|
fixCursor( self._body );
|
||||||
} catch ( error ) {
|
} catch ( error ) {
|
||||||
self.didError( error );
|
self.didError( error );
|
||||||
}
|
}
|
||||||
};
|
}, 0 );
|
||||||
|
|
||||||
proto._onCut = function () {
|
|
||||||
// Save undo checkpoint
|
|
||||||
var range = this.getSelection();
|
|
||||||
this._recordUndoState( range );
|
|
||||||
this._getRangeAndRemoveBookmark( range );
|
|
||||||
this.setSelection( range );
|
|
||||||
setTimeout( function () { afterCut( this ); }, 0 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
proto._onPaste = function ( event ) {
|
proto._onPaste = function ( event ) {
|
||||||
|
|
Loading…
Reference in a new issue