0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Fix FF does not leave <a> on space

This commit is contained in:
Neil Jenkins 2018-03-18 10:34:12 +00:00
parent 465c1268be
commit 9dda7cc845
3 changed files with 15 additions and 10 deletions

View file

@ -1703,12 +1703,15 @@ var keyHandlers = {
// the link text.
node = range.endContainer;
parent = node.parentNode;
if ( range.collapsed && parent.nodeName === 'A' &&
!node.nextSibling && range.endOffset === getLength( node ) ) {
if ( range.collapsed && range.endOffset === getLength( node ) ) {
if ( node.nodeName === 'A' ) {
range.setStartAfter( node );
} else if ( parent.nodeName === 'A' && !node.nextSibling ) {
range.setStartAfter( parent );
}
}
// Delete the selection if not collapsed
else if ( !range.collapsed ) {
if ( !range.collapsed ) {
deleteContentsOfRange( range, self._root );
self._ensureBottomLine();
self.setSelection( range );

File diff suppressed because one or more lines are too long

View file

@ -432,12 +432,15 @@ var keyHandlers = {
// the link text.
node = range.endContainer;
parent = node.parentNode;
if ( range.collapsed && parent.nodeName === 'A' &&
!node.nextSibling && range.endOffset === getLength( node ) ) {
if ( range.collapsed && range.endOffset === getLength( node ) ) {
if ( node.nodeName === 'A' ) {
range.setStartAfter( node );
} else if ( parent.nodeName === 'A' && !node.nextSibling ) {
range.setStartAfter( parent );
}
}
// Delete the selection if not collapsed
else if ( !range.collapsed ) {
if ( !range.collapsed ) {
deleteContentsOfRange( range, self._root );
self._ensureBottomLine();
self.setSelection( range );