Skip to content

Commit

Permalink
Error thrown when destroying an instance in parallel with a mouseup e…
Browse files Browse the repository at this point in the history
…vent.
  • Loading branch information
oleq committed Apr 2, 2013
1 parent 1aa6e75 commit ad9f542
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/clipboard/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,24 @@
!preventBeforePasteEvent && fixCut( editor );
});

var mouseupTimeout;

// 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).
editable.attachListener( CKEDITOR.env.ie ? editable : editor.document.getDocumentElement(), 'mouseup', function() {
setTimeout( function() {
mouseupTimeout = setTimeout( function() {
setToolbarStates();
}, 0 );
});

// Make sure that deferred mouseup callback isn't executed after editor instance
// had been destroyed. This may happen when editor.destroy() is called in parallel
// with mouseup event (i.e. a button with onclick callback) (#10219).
editor.on( 'destroy', function() {
clearTimeout( mouseupTimeout );
});

editable.on( 'keyup', setToolbarStates );
}

Expand Down

0 comments on commit ad9f542

Please sign in to comment.