Ticket #8812: 8812_2.patch
File 8812_2.patch, 1.3 KB (added by , 13 years ago) |
---|
-
_source/plugins/selection/plugin.js
896 896 { 897 897 child = siblings[ siblings.length - 1 ]; 898 898 899 if ( child.nodeType == CKEDITOR.NODE_ELEMENT )899 if ( child.nodeType != CKEDITOR.NODE_TEXT ) 900 900 return { container : parent, offset : siblings.length }; 901 901 else 902 902 return { container : child, offset : child.nodeValue.length }; … … 904 904 905 905 // Start the measuring until distance overflows, meanwhile count the text nodes. 906 906 var i = siblings.length; 907 while ( distance > 0 ) 908 distance -= siblings[ --i ].nodeValue.length; 907 while ( distance > 0 && i > 0 ) 908 { 909 sibling = siblings[ --i ]; 910 if ( sibling.nodeType == CKEDITOR.NODE_TEXT ) 911 { 912 child = sibling; 913 distance -= sibling.nodeValue.length; 914 } 915 } 909 916 910 return { container : siblings[ i ], offset : -distance };917 return { container : child, offset : -distance }; 911 918 } 912 919 // Test range was one offset beyond OR behind the anchored text node. 913 920 else