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

Fix delete/backspace removing content outside editor

This commit is contained in:
Neil Jenkins 2016-03-26 11:20:28 +11:00
parent 3dca852630
commit 923a0efd1a
3 changed files with 9 additions and 9 deletions

View file

@ -1452,10 +1452,10 @@ var keyHandlers = {
// If deleted line between containers, merge newly adjacent // If deleted line between containers, merge newly adjacent
// containers. // containers.
current = previous.parentNode; current = previous.parentNode;
while ( current && !current.nextSibling ) { while ( current !== root && !current.nextSibling ) {
current = current.parentNode; current = current.parentNode;
} }
if ( current && ( current = current.nextSibling ) ) { if ( current !== root && ( current = current.nextSibling ) ) {
mergeContainers( current, root ); mergeContainers( current, root );
} }
self.setSelection( range ); self.setSelection( range );
@ -1519,10 +1519,10 @@ var keyHandlers = {
// If deleted line between containers, merge newly adjacent // If deleted line between containers, merge newly adjacent
// containers. // containers.
next = current.parentNode; next = current.parentNode;
while ( next && !next.nextSibling ) { while ( next !== root && !next.nextSibling ) {
next = next.parentNode; next = next.parentNode;
} }
if ( next && ( next = next.nextSibling ) ) { if ( next !== root && ( next = next.nextSibling ) ) {
mergeContainers( next, root ); mergeContainers( next, root );
} }
self.setSelection( range ); self.setSelection( range );

File diff suppressed because one or more lines are too long

View file

@ -278,10 +278,10 @@ var keyHandlers = {
// If deleted line between containers, merge newly adjacent // If deleted line between containers, merge newly adjacent
// containers. // containers.
current = previous.parentNode; current = previous.parentNode;
while ( current && !current.nextSibling ) { while ( current !== root && !current.nextSibling ) {
current = current.parentNode; current = current.parentNode;
} }
if ( current && ( current = current.nextSibling ) ) { if ( current !== root && ( current = current.nextSibling ) ) {
mergeContainers( current, root ); mergeContainers( current, root );
} }
self.setSelection( range ); self.setSelection( range );
@ -345,10 +345,10 @@ var keyHandlers = {
// If deleted line between containers, merge newly adjacent // If deleted line between containers, merge newly adjacent
// containers. // containers.
next = current.parentNode; next = current.parentNode;
while ( next && !next.nextSibling ) { while ( next !== root && !next.nextSibling ) {
next = next.parentNode; next = next.parentNode;
} }
if ( next && ( next = next.nextSibling ) ) { if ( next !== root && ( next = next.nextSibling ) ) {
mergeContainers( next, root ); mergeContainers( next, root );
} }
self.setSelection( range ); self.setSelection( range );