Skip to content

Commit

Permalink
Fixed also for end container.
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun authored and oleq committed Aug 29, 2013
1 parent f2cda46 commit 7f7a7aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/dom/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,18 @@ CKEDITOR.dom.range = function( root ) {
if ( endContainer.type == CKEDITOR.NODE_ELEMENT ) {
child = endContainer.getChild( endOffset );

if ( !child && endContainer.getChildCount() == endOffset ) {
child = endContainer.getChild( endOffset - 1 );

if ( child && child.type == CKEDITOR.NODE_TEXT && child.getPrevious() && child.getPrevious().type == CKEDITOR.NODE_TEXT ) {
endContainer = child;
endOffset = child.getLength();
}
}

// In this case, move the start information to that
// text node.
if ( child && child.type == CKEDITOR.NODE_TEXT && endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) {
else if ( child && child.type == CKEDITOR.NODE_TEXT && endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT ) {
endContainer = child;
endOffset = 0;
}
Expand Down

0 comments on commit 7f7a7aa

Please sign in to comment.