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