mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
editor: fix crash on dragging a react node
This commit is contained in:
@@ -264,17 +264,11 @@ export class ReactNodeView<P extends ReactNodeViewProps> implements NodeView {
|
||||
const { view } = this.editor;
|
||||
const target = event.target as HTMLElement;
|
||||
|
||||
// get the drag handle element
|
||||
// `closest` is not available for text nodes so we may have to use its parent
|
||||
const dragHandle =
|
||||
target.nodeType === 3
|
||||
? target.parentElement?.closest("[data-drag-handle]")
|
||||
: target.closest("[data-drag-handle]");
|
||||
const dragHandle = this.dom.querySelector("[data-drag-handle]");
|
||||
const dragImage = this.dom.querySelector("[data-drag-image]") || this.dom;
|
||||
|
||||
if (!this.dom || this.contentDOM?.contains(target) || !dragHandle) return;
|
||||
|
||||
const dragImage = this.dom.querySelector("[data-drag-image]") || this.dom;
|
||||
|
||||
// workaround to prevent opening of keyboard on drag start
|
||||
if (isAndroid || isiOS) {
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user