improve draggable example

This commit is contained in:
Philipp Kühn
2020-11-25 17:19:24 +01:00
parent e407c5ebf3
commit b7ca33aeae
3 changed files with 35 additions and 7 deletions

View File

@@ -63,7 +63,7 @@ class VueNodeView implements NodeView {
})
}
handleDragStart(event: Event) {
handleDragStart(event: DragEvent) {
const { view } = this.editor
const target = (event.target as HTMLElement)
@@ -71,6 +71,8 @@ class VueNodeView implements NodeView {
return
}
event.dataTransfer?.setDragImage(this.dom, 0, 0)
const selection = NodeSelection.create(view.state.doc, this.getPos())
const transaction = view.state.tr.setSelection(selection)