UNPKG

@blocknote/core

Version:

A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.

20 lines (18 loc) 527 B
import { EditorView } from "prosemirror-view"; export function getDraggableBlockFromElement( element: Element, view: EditorView, ) { while ( element && element.parentElement && element.parentElement !== view.dom && element.getAttribute?.("data-node-type") !== "blockContainer" ) { element = element.parentElement; } if (element.getAttribute?.("data-node-type") !== "blockContainer") { return undefined; } return { node: element as HTMLElement, id: element.getAttribute("data-id")! }; }