Skip to content

Commit

Permalink
Fixed drop to the textarea on Safari.
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun committed Jul 3, 2014
1 parent 7be5499 commit 2852316
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/clipboard/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1712,15 +1712,16 @@
this.$.setData( clipboardIdDataType, this.id );
}

// Without setData( 'text', ... ) on dragstart there is no drop event in Safari.
if ( evt.name == 'dragstart' && CKEDITOR.env.safari ) {
evt.data.$.dataTransfer.setData( 'text', evt.data.$.dataTransfer.getData( 'text' ) );
}

if ( editor ) {
this.sourceEditor = editor;
this.dataValue = editor.getSelection().getSelectedHtml(); // @todo replace with the new function
this.dataType = 'html';

// Without setData( 'text', ... ) on dragstart there is no drop event in Safari.
// Also 'text' data is empty as drop to the textarea does not work if we do not put there text.
if ( evt.name == 'dragstart' && CKEDITOR.env.safari ) {
evt.data.$.dataTransfer.setData( 'text', editor.getSelection().getSelectedText() );
}
} else {
// IE support only text data and throws exception if we try to get html data.
// This html data object may also be empty if we drag content of the textarea.
Expand Down

0 comments on commit 2852316

Please sign in to comment.