mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Ensure root node is never returned by get(Start|End)BlockOfRange
Fixes #237
This commit is contained in:
parent
e1d30b7082
commit
78b638f79b
3 changed files with 5 additions and 5 deletions
|
@ -1111,7 +1111,7 @@ var getStartBlockOfRange = function ( range, root ) {
|
|||
// If inline, get the containing block.
|
||||
if ( isInline( container ) ) {
|
||||
block = getPreviousBlock( container, root );
|
||||
} else if ( isBlock( container ) ) {
|
||||
} else if ( container !== root && isBlock( container ) ) {
|
||||
block = container;
|
||||
} else {
|
||||
block = getNodeBefore( container, range.startOffset );
|
||||
|
@ -1130,7 +1130,7 @@ var getEndBlockOfRange = function ( range, root ) {
|
|||
// If inline, get the containing block.
|
||||
if ( isInline( container ) ) {
|
||||
block = getPreviousBlock( container, root );
|
||||
} else if ( isBlock( container ) ) {
|
||||
} else if ( container !== root && isBlock( container ) ) {
|
||||
block = container;
|
||||
} else {
|
||||
block = getNodeAfter( container, range.endOffset );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -419,7 +419,7 @@ var getStartBlockOfRange = function ( range, root ) {
|
|||
// If inline, get the containing block.
|
||||
if ( isInline( container ) ) {
|
||||
block = getPreviousBlock( container, root );
|
||||
} else if ( isBlock( container ) ) {
|
||||
} else if ( container !== root && isBlock( container ) ) {
|
||||
block = container;
|
||||
} else {
|
||||
block = getNodeBefore( container, range.startOffset );
|
||||
|
@ -438,7 +438,7 @@ var getEndBlockOfRange = function ( range, root ) {
|
|||
// If inline, get the containing block.
|
||||
if ( isInline( container ) ) {
|
||||
block = getPreviousBlock( container, root );
|
||||
} else if ( isBlock( container ) ) {
|
||||
} else if ( container !== root && isBlock( container ) ) {
|
||||
block = container;
|
||||
} else {
|
||||
block = getNodeAfter( container, range.endOffset );
|
||||
|
|
Loading…
Reference in a new issue