Ticket #6992: 6992_2.patch

File 6992_2.patch, 1.4 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/selection/plugin.js

     
    599599                                                                return { container : parent, offset : getNodeIndex( child ) };
    600600                                                }
    601601
    602                                                 // All childs are text nodes.
    603                                                 if ( index == -1 )
     602                                                // All childs are text nodes,
     603                                                // or to the right hand of test range are all text nodes. (#6992)
     604                                                if ( index == -1 || index == siblings.length - 1 && position < 0 )
    604605                                                {
    605606                                                        // Adapt test range to embrace the entire parent contents.
    606607                                                        testRange.moveToElementText( parent );
     
    613614
    614615                                                        siblings = parent.childNodes;
    615616
    616                                                         // Actual range anchor right beside test range at the inner boundary of text node.
     617                                                        // Actual range anchor right beside test range at the boundary of text node.
    617618                                                        if ( !distance )
    618619                                                        {
    619620                                                                child = siblings[ siblings.length - 1 ];
    620                                                                 return  { container : child, offset : child.nodeValue.length };
     621
     622                                                                if ( child.nodeType == CKEDITOR.NODE_ELEMENT )
     623                                                                        return { container : parent, offset : siblings.length };
     624                                                                else
     625                                                                        return { container : child, offset : child.nodeValue.length };
    621626                                                        }
    622627
    623628                                                        // Start the measuring until distance overflows, meanwhile count the text nodes.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy