Index: _source/core/dom/walker.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/core/dom/walker.js (revision 7511)
+++ _source/core/dom/walker.js (revision )
@@ -446,7 +446,7 @@
};
};
- CKEDITOR.dom.walker.bogus = function( type, isReject )
+ CKEDITOR.dom.walker.bogus = function( isReject )
{
function nonEmpty( node )
{
Index: _source/plugins/wysiwygarea/plugin.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/plugins/wysiwygarea/plugin.js (revision 7528)
+++ _source/plugins/wysiwygarea/plugin.js (revision )
@@ -13,7 +13,9 @@
// Matching an empty paragraph at the end of document.
var emptyParagraphRegexp = /(^|
]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
- var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
+ var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true ),
+ notBogus = CKEDITOR.dom.walker.bogus( true ),
+ notEmpty = function( node ) { return notWhitespaceEval( node ) && notBogus( node ); };
// Elements that could blink the cursor anchoring beside it, like hr, page-break. (#6554)
function nonEditable( element )
@@ -267,16 +269,25 @@
{
range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
- // If we're inserting a block element immediatelly followed by
- // another block element, the selection must move there. (#3100,#5436)
+ // If we're inserting a block element immediately followed by
+ // another block element, the selection must be optimized. (#3100,#5436,#8950)
if ( isBlock )
{
- var next = lastElement.getNext( notWhitespaceEval ),
+ var next = lastElement.getNext( notEmpty ),
nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName();
- // Check if it's a block element that accepts text.
- if ( nextName && CKEDITOR.dtd.$block[ nextName ] && CKEDITOR.dtd[ nextName ]['#'] )
+ // If the next one is a text block, move cursor to the start of it's content.
+ if ( nextName && CKEDITOR.dtd.$block[ nextName ] )
+ {
+ if ( CKEDITOR.dtd[ nextName ][ '#' ] )
- range.moveToElementEditStart( next );
+ range.moveToElementEditStart( next );
+ // Otherwise move cursor to the before end of the last element.
+ else
+ range.moveToElementEditEnd( lastElement );
+ }
+ // Append new block the inserted is already the last element of parent.
+ else if ( !next )
+ range.fixBlock( true, this.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
}
}
Index: _source/core/dom/element.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/core/dom/element.js (revision 7525)
+++ _source/core/dom/element.js (revision )
@@ -736,7 +736,8 @@
|| this.getComputedStyle( 'display' ) == 'none'
|| this.getComputedStyle( 'visibility' ) == 'hidden'
|| this.is( 'a' ) && this.data( 'cke-saved-name' ) && !this.getChildCount()
- || CKEDITOR.dtd.$nonEditable[ name ] )
+ || CKEDITOR.dtd.$nonEditable[ name ]
+ || CKEDITOR.dtd.$empty[ name ] )
{
return false;
}
Index: _source/core/dom/range.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- _source/core/dom/range.js (revision 7511)
+++ _source/core/dom/range.js (revision )
@@ -513,7 +513,7 @@
if ( serializable )
{
baseId = 'cke_bm_' + CKEDITOR.tools.getNextNumber();
- startNode.setAttribute( 'id', baseId + 'S' );
+ startNode.setAttribute( 'id', baseId + ( collapsed ? 'C' : 'S' ) );
}
// If collapsed, the endNode will not be created.
@@ -544,7 +544,7 @@
this.moveToPosition( startNode, CKEDITOR.POSITION_AFTER_END );
return {
- startNode : serializable ? baseId + 'S' : startNode,
+ startNode : serializable ? baseId + ( collapsed ? 'C' : 'S' ) : startNode,
endNode : serializable ? baseId + 'E' : endNode,
serializable : serializable,
collapsed : collapsed
@@ -1938,17 +1938,22 @@
{
var next;
- if ( node.type == CKEDITOR.NODE_ELEMENT
- && node.isEditable( false )
- && !CKEDITOR.dtd.$nonEditable[ node.getName() ] )
- {
+ if ( node.type == CKEDITOR.NODE_ELEMENT && node.isEditable( false ) )
next = node[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval );
- }
if ( !childOnly && !next )
next = node[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval );
return next;
+ }
+
+ // Handle non-editable element e.g. HR.
+ if ( el.type == CKEDITOR.NODE_ELEMENT && !el.isEditable( false ) )
+ {
+ this.moveToPosition( el, isMoveToEnd ?
+ CKEDITOR.POSITION_AFTER_END :
+ CKEDITOR.POSITION_BEFORE_START );
+ return true;
}
var found = 0;