diff --git a/packages/core/src/NodeView.ts b/packages/core/src/NodeView.ts index 9ec74b52..d0308685 100644 --- a/packages/core/src/NodeView.ts +++ b/packages/core/src/NodeView.ts @@ -88,11 +88,18 @@ export class NodeView impleme const target = (event.target as HTMLElement) const isInElement = this.dom.contains(target) && !this.contentDOM?.contains(target) - // ignore all events from child nodes + // any event from child nodes should be handled by ProseMirror if (!isInElement) { return false } + const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName) + + // any input event within node views should be ignored by ProseMirror + if (isInput) { + return true + } + const { isEditable } = this.editor const { isDragging } = this const isDraggable = !!this.node.type.spec.draggable @@ -123,9 +130,14 @@ export class NodeView impleme if (isValidDragHandle) { this.isDragging = true + document.addEventListener('dragend', () => { this.isDragging = false }, { once: true }) + + document.addEventListener('mouseup', () => { + this.isDragging = false + }, { once: true }) } }