mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Don't stop propagation of drop event (#1716)
Summary: We mirrored the fix in PR #1278 (meant for #1277) but for drop event. This fixed an issue I faced with Slate swallowing drop event, kind of breaking compatibility with react-dnd. /cc @AlbertHilb
This commit is contained in:
committed by
Ian Storm Taylor
parent
3fe60f3795
commit
bff3d34a2d
@@ -317,14 +317,15 @@ class Content extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't handle drag events coming from embedded editors.
|
// Don't handle drag and drop events coming from embedded editors.
|
||||||
if (
|
if (
|
||||||
handler == 'onDragEnd' ||
|
handler == 'onDragEnd' ||
|
||||||
handler == 'onDragEnter' ||
|
handler == 'onDragEnter' ||
|
||||||
handler == 'onDragExit' ||
|
handler == 'onDragExit' ||
|
||||||
handler == 'onDragLeave' ||
|
handler == 'onDragLeave' ||
|
||||||
handler == 'onDragOver' ||
|
handler == 'onDragOver' ||
|
||||||
handler == 'onDragStart'
|
handler == 'onDragStart' ||
|
||||||
|
handler == 'onDrop'
|
||||||
) {
|
) {
|
||||||
const { target } = event
|
const { target } = event
|
||||||
const targetEditorNode = target.closest('[data-slate-editor]')
|
const targetEditorNode = target.closest('[data-slate-editor]')
|
||||||
|
@@ -301,9 +301,6 @@ function BeforePlugin() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onDrop(event, change, editor) {
|
function onDrop(event, change, editor) {
|
||||||
// Stop propagation so the event isn't visible to parent editors.
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
// Nothing happens in read-only mode.
|
// Nothing happens in read-only mode.
|
||||||
if (editor.props.readOnly) return true
|
if (editor.props.readOnly) return true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user