import getSelectionRange from './getSelectionRange.js'; const getSelectedBlockElement = (): Element | null => { const selectionRange = getSelectionRange(); if (!selectionRange) return null; let node: Node | null = selectionRange.startContainer; do { if (node instanceof Element && node.getAttribute('data-block') === 'true') return node; node = node.parentNode; } while (node != null); return null; }; export default getSelectedBlockElement;