mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Handle all cases of overwriting content
Modern browsers tell you which character will be inserted with event.key, so we can make sure we handle content deletion ourselves in these cases too.
This commit is contained in:
parent
9dda7cc845
commit
b0ac7d32d0
3 changed files with 3 additions and 3 deletions
|
@ -1330,7 +1330,7 @@ var onKey = function ( event ) {
|
||||||
|
|
||||||
if ( this._keyHandlers[ key ] ) {
|
if ( this._keyHandlers[ key ] ) {
|
||||||
this._keyHandlers[ key ]( this, event, range );
|
this._keyHandlers[ key ]( this, event, range );
|
||||||
} else if ( key.length === 1 && !range.collapsed ) {
|
} else if ( !range.collapsed && ( event.key || key ).length === 1 ) {
|
||||||
// Record undo checkpoint.
|
// Record undo checkpoint.
|
||||||
this.saveUndoState( range );
|
this.saveUndoState( range );
|
||||||
// Delete the selection
|
// Delete the selection
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -59,7 +59,7 @@ var onKey = function ( event ) {
|
||||||
|
|
||||||
if ( this._keyHandlers[ key ] ) {
|
if ( this._keyHandlers[ key ] ) {
|
||||||
this._keyHandlers[ key ]( this, event, range );
|
this._keyHandlers[ key ]( this, event, range );
|
||||||
} else if ( key.length === 1 && !range.collapsed ) {
|
} else if ( !range.collapsed && ( event.key || key ).length === 1 ) {
|
||||||
// Record undo checkpoint.
|
// Record undo checkpoint.
|
||||||
this.saveUndoState( range );
|
this.saveUndoState( range );
|
||||||
// Delete the selection
|
// Delete the selection
|
||||||
|
|
Loading…
Reference in a new issue