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:
parent
465c1268be
commit
9dda7cc845
3 changed files with 15 additions and 10 deletions
|
@ -1703,12 +1703,15 @@ var keyHandlers = {
|
||||||
// the link text.
|
// the link text.
|
||||||
node = range.endContainer;
|
node = range.endContainer;
|
||||||
parent = node.parentNode;
|
parent = node.parentNode;
|
||||||
if ( range.collapsed && parent.nodeName === 'A' &&
|
if ( range.collapsed && range.endOffset === getLength( node ) ) {
|
||||||
!node.nextSibling && range.endOffset === getLength( node ) ) {
|
if ( node.nodeName === 'A' ) {
|
||||||
range.setStartAfter( parent );
|
range.setStartAfter( node );
|
||||||
|
} else if ( parent.nodeName === 'A' && !node.nextSibling ) {
|
||||||
|
range.setStartAfter( parent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Delete the selection if not collapsed
|
// Delete the selection if not collapsed
|
||||||
else if ( !range.collapsed ) {
|
if ( !range.collapsed ) {
|
||||||
deleteContentsOfRange( range, self._root );
|
deleteContentsOfRange( range, self._root );
|
||||||
self._ensureBottomLine();
|
self._ensureBottomLine();
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -432,12 +432,15 @@ var keyHandlers = {
|
||||||
// the link text.
|
// the link text.
|
||||||
node = range.endContainer;
|
node = range.endContainer;
|
||||||
parent = node.parentNode;
|
parent = node.parentNode;
|
||||||
if ( range.collapsed && parent.nodeName === 'A' &&
|
if ( range.collapsed && range.endOffset === getLength( node ) ) {
|
||||||
!node.nextSibling && range.endOffset === getLength( node ) ) {
|
if ( node.nodeName === 'A' ) {
|
||||||
range.setStartAfter( parent );
|
range.setStartAfter( node );
|
||||||
|
} else if ( parent.nodeName === 'A' && !node.nextSibling ) {
|
||||||
|
range.setStartAfter( parent );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Delete the selection if not collapsed
|
// Delete the selection if not collapsed
|
||||||
else if ( !range.collapsed ) {
|
if ( !range.collapsed ) {
|
||||||
deleteContentsOfRange( range, self._root );
|
deleteContentsOfRange( range, self._root );
|
||||||
self._ensureBottomLine();
|
self._ensureBottomLine();
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
|
|
Loading…
Reference in a new issue