Ticket #6621: 6621_2.patch

File 6621_2.patch, 2.5 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/styles/plugin.js

     
    13531353        function applyStyle( document, remove )
    13541354        {
    13551355                var selection = document.getSelection(),
    1356                         // Bookmark the range so we can re-select it after processing.
    1357                         bookmarks = selection.createBookmarks( 1 ),
    1358                         ranges = selection.getRanges( 1 ),
     1356                        ranges = selection.getRanges( true ),
    13591357                        func = remove ? this.removeFromRange : this.applyToRange,
    13601358                        range;
    13611359
    13621360                var iterator = ranges.createIterator();
    13631361                while ( ( range = iterator.getNextRange() ) )
     1362                {
    13641363                        func.call( this, range );
     1364                }
    13651365
    1366                 if ( bookmarks.length == 1 && bookmarks[0].collapsed )
    1367                 {
    1368                         selection.selectRanges( ranges );
    1369                         document.getById( bookmarks[ 0 ].startNode ).remove();
    1370                 }
    1371                 else
    1372                         selection.selectBookmarks( bookmarks );
    1373         }
     1366                selection.selectRanges( ranges );
     1367        }
    13741368})();
    13751369
    13761370CKEDITOR.styleCommand = function( style )
  • _source/plugins/selection/plugin.js

     
    11261126                                                if ( !between.collapsed )
    11271127                                                {
    11281128                                                        between.shrink( CKEDITOR.NODE_ELEMENT, true );
    1129                                                         if ( between.getCommonAncestor().isReadOnly())
     1129                                                        var ancestor = between.getCommonAncestor(),
     1130                                                                enclosed = between.getEnclosedNode();
     1131
     1132                                                        // The following cases has to be considered:
     1133                                                        // 1. <span contenteditable="false">[placeholder]</span>
     1134                                                        // 2. <input contenteditable="false"  type="radio"/> (#6621)
     1135                                                        if ( ancestor.isReadOnly() || enclosed && enclosed.isReadOnly() )
    11301136                                                        {
    11311137                                                                right.setStart( left.startContainer, left.startOffset );
    11321138                                                                ranges.splice( i--, 1 );
  • _source/core/dom/range.js

     
    14051405                        // Fixing invalid range start inside dtd empty elements.
    14061406                        if( startNode.type == CKEDITOR.NODE_ELEMENT
    14071407                                && CKEDITOR.dtd.$empty[ startNode.getName() ] )
    1408                                 startNode = startNode.getParent(), startOffset = startNode.getIndex();
     1408                                startOffset = startNode.getIndex(), startNode = startNode.getParent();
    14091409
    14101410                        this.startContainer     = startNode;
    14111411                        this.startOffset        = startOffset;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy