Skip to content

Commit

Permalink
Merge branch 't/9470'
Browse files Browse the repository at this point in the history
  • Loading branch information
Garry Yao committed Oct 22, 2012
2 parents e4287cd + 9b7f474 commit 77afd3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion core/htmldataprocessor.js
Expand Up @@ -196,7 +196,9 @@

cleanBogus( block );

if ( ( typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block ) !== false : fillEmptyBlock ) &&
// It's mandatory for the filler to present inside of empty block when in WYSIWYG.
if ( ( !isOutput ||
( typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block ) !== false : fillEmptyBlock ) ) &&
isEmptyBlockNeedFiller( block ) )
{
block.add( createFiller( isOutput ) );
Expand Down
23 changes: 16 additions & 7 deletions core/selection.js
Expand Up @@ -1460,13 +1460,22 @@
var nativeRange = this.document.$.createRange();
var startContainer = range.startContainer;

// In FF2, if we have a collapsed range, inside an empty
// element, we must add something to it otherwise the caret
// will not be visible.
// In Opera instead, the selection will be moved out of the
// element. (#4657)
if ( range.collapsed && ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ) && startContainer.type == CKEDITOR.NODE_ELEMENT && !startContainer.getChildCount() ) {
startContainer.appendText( '' );
// In Opera, we have some cases when a collapsed text selection cursor will be moved out of the
// anchor node:
// 1. Inside of any empty inline. (#4657)
// 2. In adjacent to any inline element.
if ( CKEDITOR.env.opera && range.collapsed && startContainer.type == CKEDITOR.NODE_ELEMENT ) {

var leftSib = startContainer.getChild( range.startOffset - 1 ),
rightSib = startContainer.getChild( range.startOffset );

if ( !leftSib && !rightSib && startContainer.is( CKEDITOR.dtd.$removeEmpty ) ||
leftSib && leftSib.type == CKEDITOR.NODE_ELEMENT && leftSib.is( CKEDITOR.dtd.$removeEmpty ) ||
rightSib && rightSib.type == CKEDITOR.NODE_ELEMENT && rightSib.is( CKEDITOR.dtd.$removeEmpty )
) {
range.insertNode( this.document.createText( '' ) );
range.collapse( 1 );
}
}

if ( range.collapsed && CKEDITOR.env.webkit && rangeRequiresFix( range ) ) {
Expand Down

0 comments on commit 77afd3d

Please sign in to comment.