Skip to content
Permalink
Browse files

Merge branch 't/11021'

  • Loading branch information...
oleq committed Jan 10, 2014
2 parents 8c72ce0 + 01fa490 commit ebd35003c6182b3660125800d86acbdb72daead9
Showing with 20 additions and 0 deletions.
  1. +1 −0 CHANGES.md
  2. +19 −0 core/selection.js
@@ -25,6 +25,7 @@ CKEditor 4 Changelog
* [#11379](http://dev.ckeditor.com/ticket/11379): Changed default contents' `line-height` to unitless values to avoid huge text overlapping (like in [#9696](http://dev.ckeditor.com/ticket/9696)).
* [#10787](http://dev.ckeditor.com/ticket/10787): [Firefox] Fixed: Broken replacement of text while pasting into div-based editor.
* [#10884](http://dev.ckeditor.com/ticket/10884): Widgets integration with [Showblocks](http://ckeditor.com/addon/showblocks) plugin.
* [#11021](http://dev.ckeditor.com/ticket/11021): Fixed: An error thrown when selecting entire editable's contents while fake selection is on.

## CKEditor 4.3.1

@@ -399,6 +399,15 @@
}
}

// Fix ranges which ends after hidden selection container.
function fixRangesAfterHiddenSelectionContainer( ranges, root, hiddenSelectionContainerIndex ) {
for ( var i = 0; i < ranges.length; ++i ) {
range = ranges[ i ];
if ( range.endContainer.equals( root ) )
range.endOffset = Math.min( range.endOffset, hiddenSelectionContainerIndex );
}
}

// Setup all editor instances for the necessary selection hooks.
CKEDITOR.on( 'instanceCreated', function( ev ) {
var editor = ev.editor;
@@ -1715,6 +1724,16 @@
* representing ranges to be added to the document.
*/
selectRanges: function( ranges ) {
var editor = this.root.editor,
hiddenSelectionContainer;

// Check if there's a hiddenSelectionContainer in editable at some index.
// Some ranges may be anchored after the hiddenSelectionContainer and,
// once the container is removed while resetting the selection, they
// may need new endOffset (one element less within the range) (#11021).
if ( editor && ( hiddenSelectionContainer = editor._.hiddenSelectionContainer ) )
fixRangesAfterHiddenSelectionContainer( ranges, this.root, hiddenSelectionContainer.getIndex() );

this.reset();

if ( !ranges.length )

0 comments on commit ebd3500

Please sign in to comment.
You can’t perform that action at this time.