@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.
1 lines • 1.16 kB
Source Map (JSON)
{"version":3,"file":"get-dom-range.cjs","sources":["../../../../src/primitives/slate/utils/get-dom-range.ts"],"sourcesContent":["import type { Editor as SlateEditor, Range as SlateRange } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\n\nconst MAX_RETRIES = 3;\n\nexport function getDOMRange(\n editor: SlateEditor,\n range: SlateRange,\n retries: number = MAX_RETRIES\n): Range | undefined {\n if (retries <= 0) {\n return;\n }\n\n try {\n return ReactEditor.toDOMRange(editor, range);\n } catch (error) {\n return getDOMRange(\n editor,\n {\n anchor: range.anchor,\n focus: range.anchor,\n },\n retries - 1\n );\n }\n}\n"],"names":["ReactEditor"],"mappings":";;;;AAGA,MAAM,WAAc,GAAA,CAAA,CAAA;AAEb,SAAS,WACd,CAAA,MAAA,EACA,KACA,EAAA,OAAA,GAAkB,WACC,EAAA;AACnB,EAAA,IAAI,WAAW,CAAG,EAAA;AAChB,IAAA,OAAA;AAAA,GACF;AAEA,EAAI,IAAA;AACF,IAAO,OAAAA,sBAAA,CAAY,UAAW,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAAA,WACpC,KAAO,EAAA;AACd,IAAO,OAAA,WAAA;AAAA,MACL,MAAA;AAAA,MACA;AAAA,QACE,QAAQ,KAAM,CAAA,MAAA;AAAA,QACd,OAAO,KAAM,CAAA,MAAA;AAAA,OACf;AAAA,MACA,OAAU,GAAA,CAAA;AAAA,KACZ,CAAA;AAAA,GACF;AACF;;;;"}