0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

If selection, delete contents before letting brower insert space

Fixes #213
This commit is contained in:
Neil Jenkins 2016-07-14 11:31:11 +10:00
parent aaf84870aa
commit d4abc182c8

View file

@ -432,6 +432,13 @@ var keyHandlers = {
!node.nextSibling && range.endOffset === getLength( node ) ) {
range.setStartAfter( parent );
}
// Delete the selection if not collapsed
else if ( !range.collapsed ) {
deleteContentsOfRange( range, self._root );
self._ensureBottomLine();
self.setSelection( range );
self._updatePath( range, true );
}
self.setSelection( range );
},