Index: /CKEditor/trunk/_source/core/dom/range.js
===================================================================
--- /CKEditor/trunk/_source/core/dom/range.js (revision 7615)
+++ /CKEditor/trunk/_source/core/dom/range.js (revision 7616)
@@ -352,5 +352,5 @@
var skipBogus = false,
bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ),
- nbspRegExp = /^[\t\r\n ]*(?: |\xa0)$/;
+ isBogus = CKEDITOR.dom.walker.bogus();
return function( node )
@@ -360,36 +360,23 @@
return true;
- if ( node.type == CKEDITOR.NODE_TEXT )
- {
- // Skip the block filler NBSP.
- if ( CKEDITOR.env.ie &&
- nbspRegExp.test( node.getText() ) &&
- !skipBogus &&
- !( isStart && node.getNext() ) )
- {
- skipBogus = true;
- }
- // If there's any visible text, then we're not at the start.
- else if ( node.hasAscendant( 'pre' ) || CKEDITOR.tools.trim( node.getText() ).length )
- return false;
- }
- else if ( node.type == CKEDITOR.NODE_ELEMENT )
- {
- // If there are non-empty inline elements (e.g. ), then we're not
- // at the start.
- if ( !inlineChildReqElements[ node.getName() ] )
- {
- // Skip the padding block br.
- if ( !CKEDITOR.env.ie &&
- node.is( 'br' ) &&
- !skipBogus &&
- !( isStart && node.getNext() ) )
- {
- skipBogus = true;
- }
- else
- return false;
- }
- }
+ // Skip the bogus node at the end of block.
+ if ( isBogus( node ) &&
+ !skipBogus )
+ {
+ skipBogus = true;
+ return true;
+ }
+
+ // If there's any visible text, then we're not at the start.
+ if ( node.type == CKEDITOR.NODE_TEXT &&
+ ( node.hasAscendant( 'pre' ) ||
+ CKEDITOR.tools.trim( node.getText() ).length ) )
+ return false;
+
+ // If there are non-empty inline elements (e.g. ), then we're not
+ // at the start.
+ if ( node.type == CKEDITOR.NODE_ELEMENT && !inlineChildReqElements[ node.getName() ] )
+ return false;
+
return true;
};
@@ -416,5 +403,6 @@
var whitespaceEval = new CKEDITOR.dom.walker.whitespaces(),
- bookmarkEval = new CKEDITOR.dom.walker.bookmark();
+ bookmarkEval = new CKEDITOR.dom.walker.bookmark(),
+ nbspRegExp = /^[\t\r\n ]*(?: |\xa0)$/;
function nonWhitespaceOrBookmarkEval( node )
@@ -1835,11 +1823,11 @@
startOffset = this.startOffset;
- // If the starting node is a text node, and non-empty before the offset,
- // then we're surely not at the start of block.
- if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
+ // [IE] Special handling for range start in text with a leading NBSP,
+ // we it to be isolated, for bogus check.
+ if ( CKEDITOR.env.ie && startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
{
var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
- if ( textBefore.length )
- return false;
+ if ( nbspRegExp.test( textBefore ) )
+ this.trim( 0, 1 );
}
@@ -1864,11 +1852,11 @@
endOffset = this.endOffset;
- // If the ending node is a text node, and non-empty after the offset,
- // then we're surely not at the end of block.
- if ( endContainer.type == CKEDITOR.NODE_TEXT )
+ // [IE] Special handling for range end in text with a following NBSP,
+ // we it to be isolated, for bogus check.
+ if ( CKEDITOR.env.ie && endContainer.type == CKEDITOR.NODE_TEXT )
{
var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
- if ( textAfter.length )
- return false;
+ if ( nbspRegExp.test( textAfter ) )
+ this.trim( 1, 0 );
}
@@ -1940,6 +1928,4 @@
moveToElementEditablePosition : function( el, isMoveToEnd )
{
- var nbspRegExp = /^[\t\r\n ]*(?: |\xa0)$/;
-
function nextDFS( node, childOnly )
{