UNPKG

@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.

48 lines (45 loc) 1.04 kB
import { Editor, Range } from 'slate'; function getCharacterBefore(editor, at, options = {}) { const { filterVoids } = options; const before = Editor.before(editor, at, { unit: "character", voids: filterVoids }); if (before) { const range = Editor.range( editor, before, Range.isRange(at) ? Range.start(at) : at ); const text = Editor.string(editor, range); return { range, text, void: text.length === 0 }; } return; } function getCharacterAfter(editor, at, options = {}) { const { filterVoids } = options; const after = Editor.after(editor, at, { unit: "character", voids: filterVoids }); if (after) { const range = Editor.range( editor, after, Range.isRange(at) ? Range.end(at) : at ); const text = Editor.string(editor, range); return { range, text, void: text.length === 0 }; } return; } export { getCharacterAfter, getCharacterBefore }; //# sourceMappingURL=get-character.js.map