Skip to content

Commit

Permalink
Merge pull request #840 from gregory-bretall/AE-839
Browse files Browse the repository at this point in the history
Drag and Drop Doesn't Work Within the Editor Fixes #839
  • Loading branch information
jbalsas authored May 17, 2018
2 parents 8287772 + 4d873ed commit bc33307
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Works on IE9+, Chrome, Firefox and Safari.
## Features

* Smart toolbars appear right near the selected text and offer different functionality based on context
* Easily add your own buttons (see the "marquee" example in [the demo](http://alloyeditor.com/demo/))
* Easily add your own buttons (see the "marquee" example in [the docs](https://alloyeditor.com/docs/develop/create/create_buttons.html))
* Paste images from clipboard, or Drag&Drop them from another application
* Insert images from the device's camera!
* Paste rich text from any web page and preserve its formatting
Expand Down
12 changes: 8 additions & 4 deletions src/plugins/addimages.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,17 @@
_onDragDrop: function(event) {
var nativeEvent = event.data.$;

new CKEDITOR.dom.event(nativeEvent).preventDefault();
var transferFiles = nativeEvent.dataTransfer.files;

var editor = event.listenerData.editor;
if (transferFiles.length > 0) {
new CKEDITOR.dom.event(nativeEvent).preventDefault();

event.listenerData.editor.createSelectionFromPoint(nativeEvent.clientX, nativeEvent.clientY);
var editor = event.listenerData.editor;

this._handleFiles(nativeEvent.dataTransfer.files, editor);
event.listenerData.editor.createSelectionFromPoint(nativeEvent.clientX, nativeEvent.clientY);

this._handleFiles(transferFiles, editor);
}
},

/**
Expand Down

0 comments on commit bc33307

Please sign in to comment.