mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Remove zws in key handlers they could affect.
This commit is contained in:
parent
d5e8ef1381
commit
4a8152d280
3 changed files with 14 additions and 2 deletions
|
@ -2824,8 +2824,11 @@ var keyHandlers = {
|
|||
if ( !range ) { return; }
|
||||
|
||||
// Save undo checkpoint and add any links in the preceding section.
|
||||
// Remove any zws so we don't think there's content in an empty
|
||||
// block.
|
||||
self._recordUndoState( range );
|
||||
addLinks( range.startContainer );
|
||||
self._removeZWS();
|
||||
self._getRangeAndRemoveBookmark( range );
|
||||
|
||||
// Selected text is overwritten, therefore delete the contents
|
||||
|
@ -2958,6 +2961,7 @@ var keyHandlers = {
|
|||
self._docWasChanged();
|
||||
},
|
||||
backspace: function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection();
|
||||
// If not collapsed, delete contents
|
||||
if ( !range.collapsed ) {
|
||||
|
@ -3025,6 +3029,7 @@ var keyHandlers = {
|
|||
}
|
||||
},
|
||||
'delete': function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection();
|
||||
// If not collapsed, delete contents
|
||||
if ( !range.collapsed ) {
|
||||
|
@ -3079,6 +3084,7 @@ var keyHandlers = {
|
|||
}
|
||||
},
|
||||
tab: function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection(),
|
||||
node, parent;
|
||||
// If no selection and in an empty block
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1705,8 +1705,11 @@ var keyHandlers = {
|
|||
if ( !range ) { return; }
|
||||
|
||||
// Save undo checkpoint and add any links in the preceding section.
|
||||
// Remove any zws so we don't think there's content in an empty
|
||||
// block.
|
||||
self._recordUndoState( range );
|
||||
addLinks( range.startContainer );
|
||||
self._removeZWS();
|
||||
self._getRangeAndRemoveBookmark( range );
|
||||
|
||||
// Selected text is overwritten, therefore delete the contents
|
||||
|
@ -1839,6 +1842,7 @@ var keyHandlers = {
|
|||
self._docWasChanged();
|
||||
},
|
||||
backspace: function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection();
|
||||
// If not collapsed, delete contents
|
||||
if ( !range.collapsed ) {
|
||||
|
@ -1906,6 +1910,7 @@ var keyHandlers = {
|
|||
}
|
||||
},
|
||||
'delete': function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection();
|
||||
// If not collapsed, delete contents
|
||||
if ( !range.collapsed ) {
|
||||
|
@ -1960,6 +1965,7 @@ var keyHandlers = {
|
|||
}
|
||||
},
|
||||
tab: function ( self, event ) {
|
||||
self._removeZWS();
|
||||
var range = self.getSelection(),
|
||||
node, parent;
|
||||
// If no selection and in an empty block
|
||||
|
|
Loading…
Reference in a new issue