0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-02 20:50:17 -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:
Neil Jenkins 2018-03-18 10:40:03 +00:00
parent 9dda7cc845
commit b0ac7d32d0
3 changed files with 3 additions and 3 deletions

View file

@ -1330,7 +1330,7 @@ var onKey = function ( event ) {
if ( this._keyHandlers[ key ] ) {
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.
this.saveUndoState( range );
// Delete the selection

File diff suppressed because one or more lines are too long

View file

@ -59,7 +59,7 @@ var onKey = function ( event ) {
if ( this._keyHandlers[ key ] ) {
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.
this.saveUndoState( range );
// Delete the selection