UNPKG

@blocknote/react

Version:

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

16 lines (13 loc) 460 B
export function elementOverflow(element: HTMLElement, container: HTMLElement) { const elementRect = element.getBoundingClientRect(); const parentRect = container.getBoundingClientRect(); const topOverflow = elementRect.top < parentRect.top; const bottomOverflow = elementRect.bottom > parentRect.bottom; return topOverflow && bottomOverflow ? "both" : topOverflow ? "top" : bottomOverflow ? "bottom" : "none"; }