Index: _source/plugins/styles/plugin.js
===================================================================
--- _source/plugins/styles/plugin.js (revision 6035)
+++ _source/plugins/styles/plugin.js (revision )
@@ -1353,24 +1353,18 @@
function applyStyle( document, remove )
{
var selection = document.getSelection(),
- // Bookmark the range so we can re-select it after processing.
- bookmarks = selection.createBookmarks( 1 ),
- ranges = selection.getRanges( 1 ),
+ ranges = selection.getRanges( true ),
func = remove ? this.removeFromRange : this.applyToRange,
range;
var iterator = ranges.createIterator();
while ( ( range = iterator.getNextRange() ) )
+ {
func.call( this, range );
+ }
- if ( bookmarks.length == 1 && bookmarks[0].collapsed )
- {
- selection.selectRanges( ranges );
+ selection.selectRanges( ranges );
- document.getById( bookmarks[ 0 ].startNode ).remove();
- }
+ }
- else
- selection.selectBookmarks( bookmarks );
- }
})();
CKEDITOR.styleCommand = function( style )
Index: _source/plugins/selection/plugin.js
===================================================================
--- _source/plugins/selection/plugin.js (revision 6030)
+++ _source/plugins/selection/plugin.js (revision )
@@ -1126,7 +1126,13 @@
if ( !between.collapsed )
{
between.shrink( CKEDITOR.NODE_ELEMENT, true );
- if ( between.getCommonAncestor().isReadOnly())
+ var ancestor = between.getCommonAncestor(),
+ enclosed = between.getEnclosedNode();
+
+ // The following cases has to be considered:
+ // 1. [placeholder]
+ // 2. (#6621)
+ if ( ancestor.isReadOnly() || enclosed && enclosed.isReadOnly() )
{
right.setStart( left.startContainer, left.startOffset );
ranges.splice( i--, 1 );
Index: _source/core/dom/range.js
===================================================================
--- _source/core/dom/range.js (revision 6031)
+++ _source/core/dom/range.js (revision )
@@ -1405,7 +1405,7 @@
// Fixing invalid range start inside dtd empty elements.
if( startNode.type == CKEDITOR.NODE_ELEMENT
&& CKEDITOR.dtd.$empty[ startNode.getName() ] )
- startNode = startNode.getParent(), startOffset = startNode.getIndex();
+ startOffset = startNode.getIndex(), startNode = startNode.getParent();
this.startContainer = startNode;
this.startOffset = startOffset;