Skip to content

Commit

Permalink
Added support for styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer authored and mlewand committed May 8, 2017
1 parent b32a7cf commit d4907f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -1829,13 +1829,25 @@ CKEDITOR.STYLE_OBJECT = 3;
var doc = selection.document,
ranges = selection.getRanges(),
func = remove ? this.removeFromRange : this.applyToRange,
range;
originalRanges,
range,
i;

// In case of fake table selection, we would like to apply all styles and then select
// the original ranges. Otherwise browsers would complain about discontiguous selection.
if ( selection.isFake && selection.isInTable() ) {
originalRanges = [];

for ( i = 0; i < ranges.length; i++ ) {
originalRanges.push( ranges[ i ].clone() );
}
}

var iterator = ranges.createIterator();
while ( ( range = iterator.getNextRange() ) )
func.call( this, range, editor );

selection.selectRanges( ranges );
selection.selectRanges( originalRanges || ranges );
doc.removeCustomData( 'doc_processing_style' );
}
} )();
Expand Down

0 comments on commit d4907f5

Please sign in to comment.