mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix range error in addFormat if start == end container.
This commit is contained in:
parent
b944eb3b3b
commit
73c4146e27
3 changed files with 9 additions and 1 deletions
|
@ -1709,6 +1709,10 @@ proto._addFormat = function ( tag, attributes, range ) {
|
|||
}
|
||||
if ( textNode === startContainer && startOffset ) {
|
||||
textNode = textNode.splitText( startOffset );
|
||||
if ( endContainer === startContainer ) {
|
||||
endContainer = textNode;
|
||||
endOffset -= startOffset;
|
||||
}
|
||||
startContainer = textNode;
|
||||
startOffset = 0;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -624,6 +624,10 @@ proto._addFormat = function ( tag, attributes, range ) {
|
|||
}
|
||||
if ( textNode === startContainer && startOffset ) {
|
||||
textNode = textNode.splitText( startOffset );
|
||||
if ( endContainer === startContainer ) {
|
||||
endContainer = textNode;
|
||||
endOffset -= startOffset;
|
||||
}
|
||||
startContainer = textNode;
|
||||
startOffset = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue