mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-03 05:00:13 -05:00
Fix block boundary issue
If the node is at the end of the document, this method can fail with 'TypeError: Cannot read property 'previousSibling' of null'
This commit is contained in:
parent
f7774c8cf3
commit
4e7e290fbc
3 changed files with 9 additions and 1 deletions
|
@ -1131,6 +1131,10 @@ var rangeDoesStartAtBlockBoundary = function ( range, root ) {
|
|||
contentWalker.currentNode = startContainer;
|
||||
} else {
|
||||
contentWalker.currentNode = getNodeAfter( startContainer, startOffset );
|
||||
|
||||
if ( !contentWalker.currentNode ) {
|
||||
contentWalker.currentNode = startContainer;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, look for any previous content in the same block.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -472,6 +472,10 @@ var rangeDoesStartAtBlockBoundary = function ( range, root ) {
|
|||
contentWalker.currentNode = startContainer;
|
||||
} else {
|
||||
contentWalker.currentNode = getNodeAfter( startContainer, startOffset );
|
||||
|
||||
if ( !contentWalker.currentNode ) {
|
||||
contentWalker.currentNode = startContainer;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, look for any previous content in the same block.
|
||||
|
|
Loading…
Reference in a new issue