diff --git a/CHANGES.md b/CHANGES.md index cdd561be1ba..7af920fa645 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ CKEditor 4 Changelog * [#9887](http://dev.ckeditor.com/ticket/9887): Disable magicline when editor.readOnly is set. * [#9882](http://dev.ckeditor.com/ticket/9882): Fixed empty document title on getData() if set via docprops dialog. * [#9773](http://dev.ckeditor.com/ticket/9773): Fixed rendering problems with select fields in Kama. +* [#9851](http://dev.ckeditor.com/ticket/9851): SelectionChange isn't fired when mouse selection finished outside editable. ## CKEditor 4.0.1 diff --git a/core/selection.js b/core/selection.js index 6740d60c665..fd501bbff4e 100644 --- a/core/selection.js +++ b/core/selection.js @@ -381,8 +381,12 @@ }); } // In all other cases listen on simple mouseup over editable, as we did before #9699. + // + // Use document instead of editable in non-IEs for observing mouseup + // since editable won't fire the event if selection process started within iframe and ended out + // of the editor (#9851). else - editable.attachListener( editable, 'mouseup', checkSelectionChangeTimeout, editor ); + editable.attachListener( CKEDITOR.env.ie ? editable : doc.getDocumentElement(), 'mouseup', checkSelectionChangeTimeout, editor ); if ( CKEDITOR.env.webkit ) { // Before keystroke is handled by editor, check to remove the filling char. diff --git a/plugins/clipboard/plugin.js b/plugins/clipboard/plugin.js index e485e557fd2..763f2841e0a 100644 --- a/plugins/clipboard/plugin.js +++ b/plugins/clipboard/plugin.js @@ -477,7 +477,10 @@ !preventBeforePasteEvent && fixCut( editor ); }); - editable.on( 'mouseup', function() { + // Use editor.document instead of editable in non-IEs for observing mouseup + // since editable won't fire the event if selection process started within + // iframe and ended out of the editor (#9851). + ( CKEDITOR.env.ie ? editable : editor.document.getDocumentElement() ).on( 'mouseup', function() { setTimeout( function() { setToolbarStates(); }, 0 );