@liveblocks/react-ui
Version:
A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.
24 lines (21 loc) • 455 B
JavaScript
import { ReactEditor } from 'slate-react';
const MAX_RETRIES = 3;
function getDOMRange(editor, range, retries = MAX_RETRIES) {
if (retries <= 0) {
return;
}
try {
return ReactEditor.toDOMRange(editor, range);
} catch (error) {
return getDOMRange(
editor,
{
anchor: range.anchor,
focus: range.anchor
},
retries - 1
);
}
}
export { getDOMRange };
//# sourceMappingURL=get-dom-range.js.map