fix: Separate drags from drops in stopEvent (#2070)
* Separate drags from drops in stopEvent * Move !isDropEvent
This commit is contained in:
@@ -113,11 +113,12 @@ export class NodeView<
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isDropEvent = event.type === 'drop'
|
||||||
const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName)
|
const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName)
|
||||||
|| target.isContentEditable
|
|| target.isContentEditable
|
||||||
|
|
||||||
// any input event within node views should be ignored by ProseMirror
|
// any input event within node views should be ignored by ProseMirror
|
||||||
if (isInput) {
|
if (isInput && !isDropEvent) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ export class NodeView<
|
|||||||
const isPasteEvent = event.type === 'paste'
|
const isPasteEvent = event.type === 'paste'
|
||||||
const isCutEvent = event.type === 'cut'
|
const isCutEvent = event.type === 'cut'
|
||||||
const isClickEvent = event.type === 'mousedown'
|
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
|
// ProseMirror tries to drag selectable nodes
|
||||||
// even if `draggable` is set to `false`
|
// even if `draggable` is set to `false`
|
||||||
@@ -165,6 +166,7 @@ export class NodeView<
|
|||||||
// these events are handled by prosemirror
|
// these events are handled by prosemirror
|
||||||
if (
|
if (
|
||||||
isDragging
|
isDragging
|
||||||
|
|| isDropEvent
|
||||||
|| isCopyEvent
|
|| isCopyEvent
|
||||||
|| isPasteEvent
|
|| isPasteEvent
|
||||||
|| isCutEvent
|
|| isCutEvent
|
||||||
|
|||||||
Reference in New Issue
Block a user