mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 23:40:35 -05:00
Fix error thrown inserting tree fragment at start/end of document.
This commit is contained in:
parent
c29a8c639b
commit
c25bfe8a9f
1 changed files with 4 additions and 3 deletions
|
@ -250,8 +250,9 @@ var insertTreeFragmentIntoRange = function ( range, frag ) {
|
|||
nodeBeforeSplit = next.previousSibling;
|
||||
}
|
||||
if ( !startContainer.parentNode ) {
|
||||
startContainer = nodeBeforeSplit;
|
||||
startOffset = nodeBeforeSplit.childNodes.length;
|
||||
startContainer = nodeBeforeSplit || next.parentNode;
|
||||
startOffset = nodeBeforeSplit ?
|
||||
nodeBeforeSplit.childNodes.length : 0;
|
||||
}
|
||||
// Merge inserted containers with edges of split
|
||||
if ( isContainer( next ) ) {
|
||||
|
@ -277,7 +278,7 @@ var insertTreeFragmentIntoRange = function ( range, frag ) {
|
|||
endOffset = prev.childNodes.length;
|
||||
}
|
||||
// Merge inserted containers with edges of split
|
||||
if ( isContainer( nodeAfterSplit ) ) {
|
||||
if ( nodeAfterSplit && isContainer( nodeAfterSplit ) ) {
|
||||
mergeContainers( nodeAfterSplit );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue