mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Squire: Fix possible error when deleting range
This commit is contained in:
parent
d9122222b2
commit
66c0b20702
4 changed files with 11 additions and 3 deletions
|
@ -361,6 +361,10 @@ function fixCursor ( node, root ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( node.nodeType === TEXT_NODE ) {
|
||||
return originalNode;
|
||||
}
|
||||
|
||||
if ( isInline( node ) ) {
|
||||
child = node.firstChild;
|
||||
while ( cantFocusEmptyTextNodes && child &&
|
||||
|
@ -806,8 +810,8 @@ var deleteContentsOfRange = function ( range, root ) {
|
|||
moveRangeBoundariesDownTree( range );
|
||||
|
||||
// If we split into two different blocks, merge the blocks.
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
if ( needsMerge ) {
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
endBlock = getEndBlockOfRange( range, root );
|
||||
if ( startBlock && endBlock && startBlock !== endBlock ) {
|
||||
mergeWithBlock( startBlock, endBlock, range );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -190,6 +190,10 @@ function fixCursor ( node, root ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( node.nodeType === TEXT_NODE ) {
|
||||
return originalNode;
|
||||
}
|
||||
|
||||
if ( isInline( node ) ) {
|
||||
child = node.firstChild;
|
||||
while ( cantFocusEmptyTextNodes && child &&
|
||||
|
|
|
@ -153,8 +153,8 @@ var deleteContentsOfRange = function ( range, root ) {
|
|||
moveRangeBoundariesDownTree( range );
|
||||
|
||||
// If we split into two different blocks, merge the blocks.
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
if ( needsMerge ) {
|
||||
startBlock = getStartBlockOfRange( range, root );
|
||||
endBlock = getEndBlockOfRange( range, root );
|
||||
if ( startBlock && endBlock && startBlock !== endBlock ) {
|
||||
mergeWithBlock( startBlock, endBlock, range );
|
||||
|
|
Loading…
Reference in a new issue