mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -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 ) {
|
function split ( node, offset, stopNode ) {
|
||||||
var nodeType = node.nodeType,
|
var nodeType = node.nodeType,
|
||||||
parent, clone, next;
|
parent, clone, next;
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE && node !== stopNode ) {
|
||||||
if ( node === stopNode ) {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
return split( node.parentNode, node.splitText( offset ), stopNode );
|
return split( node.parentNode, node.splitText( offset ), stopNode );
|
||||||
}
|
}
|
||||||
if ( nodeType === ELEMENT_NODE ) {
|
if ( nodeType === ELEMENT_NODE ) {
|
||||||
|
@ -391,7 +388,7 @@ function split ( node, offset, stopNode ) {
|
||||||
// Keep on splitting up the tree
|
// Keep on splitting up the tree
|
||||||
return split( parent, clone, stopNode );
|
return split( parent, clone, stopNode );
|
||||||
}
|
}
|
||||||
return node;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeInlines ( node, range ) {
|
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 ) {
|
function split ( node, offset, stopNode ) {
|
||||||
var nodeType = node.nodeType,
|
var nodeType = node.nodeType,
|
||||||
parent, clone, next;
|
parent, clone, next;
|
||||||
if ( nodeType === TEXT_NODE ) {
|
if ( nodeType === TEXT_NODE && node !== stopNode ) {
|
||||||
if ( node === stopNode ) {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
return split( node.parentNode, node.splitText( offset ), stopNode );
|
return split( node.parentNode, node.splitText( offset ), stopNode );
|
||||||
}
|
}
|
||||||
if ( nodeType === ELEMENT_NODE ) {
|
if ( nodeType === ELEMENT_NODE ) {
|
||||||
|
@ -262,7 +259,7 @@ function split ( node, offset, stopNode ) {
|
||||||
// Keep on splitting up the tree
|
// Keep on splitting up the tree
|
||||||
return split( parent, clone, stopNode );
|
return split( parent, clone, stopNode );
|
||||||
}
|
}
|
||||||
return node;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeInlines ( node, range ) {
|
function mergeInlines ( node, range ) {
|
||||||
|
|
Loading…
Reference in a new issue