fix(mail-merge): Fix drag and drop for files vs. chips

This commit is contained in:
Ben Gotow 2016-04-29 11:57:40 -07:00
parent db899491ea
commit 105e33c9c4
5 changed files with 14 additions and 2 deletions

View file

@ -217,6 +217,9 @@ class ComposerEditor extends Component {
this.refs.contenteditable._onDragOver(event)
}
_shouldAcceptDrop(event) {
return this.refs.contenteditable._shouldAcceptDrop(event)
}
// Helpers
_scrollToBottom = ()=> {
@ -302,7 +305,7 @@ class ComposerEditor extends Component {
className="composer-inner-wrap"
onDrop={::this._onDrop}
onDragOver={::this._onDragOver}
shouldAcceptDrop={() => true}
shouldAcceptDrop={::this._shouldAcceptDrop}
>
<Contenteditable
ref="contenteditable"

View file

@ -38,6 +38,7 @@ body.platform-win32 {
border: 4px dashed lighten(@gray, 30%);
text-align: center;
line-height:2.3em;
pointer-events: none;
.centered {
position: absolute;

View file

@ -350,6 +350,11 @@ class Contenteditable extends React.Component
_onDrop: (event) =>
@dispatchEventToExtensions("onDrop", event)
_shouldAcceptDrop: (event) =>
for extension in [].concat(@props.extensions, @coreExtensions)
return true if extension.shouldAcceptDrop?.call(extension, {event})
return false
# We must set the `inCompositionEvent` flag in addition to tearing down
# the selecton listeners. While the composition event is in progress, we
# want to ignore any input events we get.

View file

@ -31,6 +31,7 @@ class DropZone extends React.Component
@_dragCounter += 1
if @_dragCounter is 1 and @props.onDragStateChange
@props.onDragStateChange(isDropping: true)
e.stopPropagation()
return
_onDragLeave: (e) =>
@ -38,6 +39,7 @@ class DropZone extends React.Component
@_dragCounter -= 1
if @_dragCounter is 0 and @props.onDragStateChange
@props.onDragStateChange(isDropping: false)
e.stopPropagation()
return
_onDrop: (e) =>
@ -46,6 +48,7 @@ class DropZone extends React.Component
@props.onDragStateChange(isDropping: false)
@_dragCounter = 0
@props.onDrop(e)
e.stopPropagation()
return
module.exports = DropZone

@ -1 +1 @@
Subproject commit ebef587e6eeef3c3e76bb6c25a52b93e08ee9a00
Subproject commit c9b1972462e7b09b047456bb96a49db0b62443e3