Skip to content

Commit

Permalink
Merge pull request #3359 from summernote/rollback-disableDragAndDrop
Browse files Browse the repository at this point in the history
Revert "Simply the logic of disableDragAndDrop"
  • Loading branch information
lqez committed Aug 15, 2019
2 parents bb6059b + 3854965 commit b7fe4f7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/js/base/module/Dropzone.js
Expand Up @@ -17,15 +17,21 @@ export default class Dropzone {
].join('')).prependTo(this.$editor);
}

shouldInitialize() {
return !this.options.disableDragAndDrop;
}

/**
* attach Drag and Drop Events
*/
initialize() {
this.attachDragAndDropEvent();
if (this.options.disableDragAndDrop) {
// prevent default drop event
this.documentEventHandlers.onDrop = (e) => {
e.preventDefault();
};
// do not consider outside of dropzone
this.$eventListener = this.$dropzone;
this.$eventListener.on('drop', this.documentEventHandlers.onDrop);
} else {
this.attachDragAndDropEvent();
}
}

/**
Expand Down

0 comments on commit b7fe4f7

Please sign in to comment.