Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate drags from drops in stopEvent #2070

Merged
merged 2 commits into from
Oct 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/NodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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`
Expand Down Expand Up @@ -165,6 +166,7 @@ export class NodeView<
// these events are handled by prosemirror
if (
isDragging
|| isDropEvent
|| isCopyEvent
|| isPasteEvent
|| isCutEvent
Expand Down