mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Always return nodeAfterSplit from split fn
This commit is contained in:
parent
77b0b6c716
commit
20f92c9785
3 changed files with 5 additions and 11 deletions
|
@ -348,10 +348,7 @@ function fixCursor ( node ) {
|
|||
function split ( node, offset, stopNode ) {
|
||||
var nodeType = node.nodeType,
|
||||
parent, clone, next;
|
||||
if ( nodeType === TEXT_NODE ) {
|
||||
if ( node === stopNode ) {
|
||||
return offset;
|
||||
}
|
||||
if ( nodeType === TEXT_NODE && node !== stopNode ) {
|
||||
return split( node.parentNode, node.splitText( offset ), stopNode );
|
||||
}
|
||||
if ( nodeType === ELEMENT_NODE ) {
|
||||
|
@ -391,7 +388,7 @@ function split ( node, offset, stopNode ) {
|
|||
// Keep on splitting up the tree
|
||||
return split( parent, clone, stopNode );
|
||||
}
|
||||
return node;
|
||||
return offset;
|
||||
}
|
||||
|
||||
function mergeInlines ( node, range ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -219,10 +219,7 @@ function fixCursor ( node ) {
|
|||
function split ( node, offset, stopNode ) {
|
||||
var nodeType = node.nodeType,
|
||||
parent, clone, next;
|
||||
if ( nodeType === TEXT_NODE ) {
|
||||
if ( node === stopNode ) {
|
||||
return offset;
|
||||
}
|
||||
if ( nodeType === TEXT_NODE && node !== stopNode ) {
|
||||
return split( node.parentNode, node.splitText( offset ), stopNode );
|
||||
}
|
||||
if ( nodeType === ELEMENT_NODE ) {
|
||||
|
@ -262,7 +259,7 @@ function split ( node, offset, stopNode ) {
|
|||
// Keep on splitting up the tree
|
||||
return split( parent, clone, stopNode );
|
||||
}
|
||||
return node;
|
||||
return offset;
|
||||
}
|
||||
|
||||
function mergeInlines ( node, range ) {
|
||||
|
|
Loading…
Reference in a new issue