Skip to content

Commit

Permalink
Merge branch 't/11082b' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Nov 6, 2013
2 parents 900177c + 5cd60b6 commit 176e843
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Fixed Issues:
* [#11057](http://dev.ckeditor.com/ticket/11057): Fixed: Regression in #10212 test.
* [#10430](http://dev.ckeditor.com/ticket/10430): Resolve dependence of image plugin if forms plugin.
* [#10911](http://dev.ckeditor.com/ticket/10911): Browser alt hotkeys will no longer be blocked while widget is focused.
* [#11082](http://dev.ckeditor.com/ticket/11082): Selected widget is not copied/cut when using toolbar buttons or context menu.

## CKEditor 4.3 Beta

Expand Down
23 changes: 23 additions & 0 deletions plugins/widget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
setupMouseObserver( this );
setupKeyboardObserver( this );
setupDragAndDrop( this );
setupNativeCutAndCopy( this );
}

Repository.prototype = {
Expand Down Expand Up @@ -2015,6 +2016,26 @@
}, null, null, 1 );
}

// Setup copybin on native copy and cut events in order to handle copy and cut commands
// if user accepted security alert on IEs.
// Note: when copying or cutting using keystroke, copySingleWidget will be first executed
// by the keydown listener. Conflict between two calls will be resolved by copy_bin existence check.
function setupNativeCutAndCopy( widgetsRepo ) {
var editor = widgetsRepo.editor;

editor.on( 'contentDom', function() {
var editable = editor.editable();

editable.attachListener( editable, 'copy', eventListener );
editable.attachListener( editable, 'cut', eventListener );
} );

function eventListener( evt ) {
if ( widgetsRepo.focused )
copySingleWidget( widgetsRepo.focused, evt.name == 'cut' );
}
}

// Setup selection observer which will trigger:
// * widget select & focus on selection change,
// * nested editable focus (related properites and classes) on selection change,
Expand Down Expand Up @@ -2281,6 +2302,8 @@
doc = editor.document;

// We're still handling previous copy/cut.
// When keystroke is used to copy/cut this will also prevent
// conflict with copySingleWidget called again for native copy/cut event.
if ( doc.getById( 'cke_copybin' ) )
return;

Expand Down

0 comments on commit 176e843

Please sign in to comment.