Skip to content

Commit

Permalink
Add workaround for #3423.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer committed Sep 17, 2019
1 parent 7be91d9 commit b4cf4d8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/widget/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,7 @@

function copyWidgets( editor, isCut ) {
var focused = editor.widgets.focused,
isWholeSelection,
copyBin,
bookmarks;

Expand All @@ -3358,6 +3359,10 @@
if ( bookmarks ) {
editor.getSelection().selectBookmarks( bookmarks );
}

if ( isWholeSelection ) {
CKEDITOR.plugins.widgetselection.addFillers( editor.editable() );
}
},

afterDestroy: function() {
Expand All @@ -3369,9 +3374,11 @@
} );

// When more than one widget is selected, we must save selection to restore it
// after destroying copybin (#3138).
// after destroying copybin. Additionally we have to work around issue with selecting all in
// Blink and WebKit, when widgets are at the beginning and at the end of the content (#3138).
if ( !focused ) {
bookmarks = editor.getSelection().createBookmarks( true );
isWholeSelection = CKEDITOR.env.webkit && CKEDITOR.plugins.widgetselection.isWholeContentSelected( editor.editable() );
bookmarks = !isWholeSelection && editor.getSelection().createBookmarks( true );
}

copyBin.handle( getClipboardHtml() );
Expand Down

0 comments on commit b4cf4d8

Please sign in to comment.