From bebaa4045e6be2e59d1b9c2e1f61f088a47fdf1b Mon Sep 17 00:00:00 2001 From: Jon Noronha Date: Fri, 22 Oct 2021 12:27:58 -0700 Subject: [PATCH] fix: Separate drags from drops in stopEvent (#2070) * Separate drags from drops in stopEvent * Move !isDropEvent --- packages/core/src/NodeView.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/NodeView.ts b/packages/core/src/NodeView.ts index 020582f5..16f9afc8 100644 --- a/packages/core/src/NodeView.ts +++ b/packages/core/src/NodeView.ts @@ -113,11 +113,12 @@ export class NodeView< return false } + const isDropEvent = event.type === 'drop' const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName) || target.isContentEditable // any input event within node views should be ignored by ProseMirror - if (isInput) { + if (isInput && !isDropEvent) { return true } @@ -129,7 +130,7 @@ export class NodeView< const isPasteEvent = event.type === 'paste' const isCutEvent = event.type === 'cut' const isClickEvent = event.type === 'mousedown' - const isDragEvent = event.type.startsWith('drag') || event.type === 'drop' + const isDragEvent = event.type.startsWith('drag') // ProseMirror tries to drag selectable nodes // even if `draggable` is set to `false` @@ -165,6 +166,7 @@ export class NodeView< // these events are handled by prosemirror if ( isDragging + || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent