Skip to content
Permalink
Browse files

Merge branch 't/9552'

  • Loading branch information...
Reinmar committed Nov 5, 2012
2 parents d8c53c1 + b1f343e commit 6dc63a1a04dc73a1516f451d22e21e9a24b75edc
Showing with 17 additions and 6 deletions.
  1. +3 −0 core/selection.js
  2. +14 −6 plugins/clipboard/plugin.js
@@ -571,12 +571,15 @@
* Select this range as the only one with {@link CKEDITOR.dom.selection#selectRanges}.
*
* @method
* @returns {CKEDITOR.dom.selection}
* @member CKEDITOR.dom.range
*/
CKEDITOR.dom.range.prototype.select = function() {
var sel = this.root instanceof CKEDITOR.editable ? this.root.editor.getSelection() : new CKEDITOR.dom.selection( this.root );

sel.selectRanges( [ this ] );

return sel;
};

/**
@@ -708,15 +708,23 @@
// Temporarily move selection to the pastebin.
isEditingHost && pastebin.focus();
var range = new CKEDITOR.dom.range( pastebin );
range.setStartAt( pastebin, CKEDITOR.POSITION_AFTER_START );
range.setEndAt( pastebin, CKEDITOR.POSITION_BEFORE_END );
range.select();
range.selectNodeContents( pastebin );
var sel = range.select();

// If non-native paste is executed, IE will open security alert and blur editable.
// Editable will then lock selection inside itself and after accepting security alert
// this selection will be restored. We overwrite stored selection, so it's restored
// in pastebin. (#9552)
if ( CKEDITOR.env.ie ) {
var blurListener = editable.once( 'blur', function( evt ) {
editor.lockSelection( sel );
} );
}

// Wait a while and grab the pasted contents.
setTimeout( function() {

// Cancel the locked selection.
editor.unlockSelection();
// Blur will be fired only on non-native paste. In other case manually remove listener.
blurListener && blurListener.removeListener();

// Restore properly the document focus. (#8849)
if ( CKEDITOR.env.ie )

0 comments on commit 6dc63a1

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