ReactEditor
ReactEditor is added to Editor when it is instantiated using the withReact method.
const [editor] = useState(() => withReact(withHistory(createEditor())))Static methods
Check methods
ReactEditor.isComposing(editor: ReactEditor): boolean
ReactEditor.isComposing(editor: ReactEditor): booleanCheck if the user is currently composing inside the editor.
ReactEditor.isFocused(editor: ReactEditor): boolean
ReactEditor.isFocused(editor: ReactEditor): booleanCheck if the editor is focused.
ReactEditor.isReadOnly(editor: ReactEditor): boolean
ReactEditor.isReadOnly(editor: ReactEditor): booleanCheck if the editor is in read-only mode.
Focus and selection methods
ReactEditor.blur(editor: ReactEditor): void
ReactEditor.blur(editor: ReactEditor): voidBlur the editor.
ReactEditor.focus(editor: ReactEditor): void
ReactEditor.focus(editor: ReactEditor): voidFocus the editor.
ReactEditor.deselect(editor: ReactEditor): void
ReactEditor.deselect(editor: ReactEditor): voidDeselect the editor.
DOM translation methods
ReactEditor.findKey(editor: ReactEditor, node: Node): Key
ReactEditor.findKey(editor: ReactEditor, node: Node): KeyFind a key for a Slate node.
Returns an instance of Key which looks like { id: string }
ReactEditor.findPath(editor: ReactEditor, node: Node): Path
ReactEditor.findPath(editor: ReactEditor, node: Node): PathFind the path of Slate node.
ReactEditor.hasDOMNode(editor: ReactEditor, target: DOMNode, options: { editable?: boolean } = {}): boolean
ReactEditor.hasDOMNode(editor: ReactEditor, target: DOMNode, options: { editable?: boolean } = {}): booleanCheck if a DOM node is within the editor.
ReactEditor.toDOMNode(editor: ReactEditor, node: Node): HTMLElement
ReactEditor.toDOMNode(editor: ReactEditor, node: Node): HTMLElementFind the native DOM element from a Slate node.
ReactEditor.toDOMPoint(editor: ReactEditor, point: Point): DOMPoint
ReactEditor.toDOMPoint(editor: ReactEditor, point: Point): DOMPointFind a native DOM selection point from a Slate point.
ReactEditor.toDOMRange(editor: ReactEditor, range: Range): DOMRange
ReactEditor.toDOMRange(editor: ReactEditor, range: Range): DOMRangeFind a native DOM range from a Slate range.
ReactEditor.toSlateNode(editor: ReactEditor, domNode: DOMNode): Node
ReactEditor.toSlateNode(editor: ReactEditor, domNode: DOMNode): NodeFind a Slate node from a native DOM element.
ReactEditor.findEventRange(editor: ReactEditor, event: any): Range
ReactEditor.findEventRange(editor: ReactEditor, event: any): RangeGet the target range from a DOM event.
ReactEditor.toSlatePoint(editor: ReactEditor, domPoint: DOMPoint): Point | null
ReactEditor.toSlatePoint(editor: ReactEditor, domPoint: DOMPoint): Point | nullFind a Slate point from a DOM selection's domNode and domOffset.
ReactEditor.toSlateRange(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection, options?: { exactMatch?: boolean } = {}): Range | null
ReactEditor.toSlateRange(editor: ReactEditor, domRange: DOMRange | DOMStaticRange | DOMSelection, options?: { exactMatch?: boolean } = {}): Range | nullFind a Slate range from a DOM range or selection.
DataTransfer methods
ReactEditor.insertData(editor: ReactEditor, data: DataTransfer): void
ReactEditor.insertData(editor: ReactEditor, data: DataTransfer): voidInsert data from a DataTransfer into the editor. This is a proxy method to call in this order insertFragmentData(editor: ReactEditor, data: DataTransfer) and then insertTextData(editor: ReactEditor, data: DataTransfer).
ReactEditor.insertFragmentData(editor: ReactEditor, data: DataTransfer): true
ReactEditor.insertFragmentData(editor: ReactEditor, data: DataTransfer): trueInsert fragment data from a DataTransfer into the editor. Returns true if some content has been effectively inserted.
ReactEditor.insertTextData(editor: ReactEditor, data: DataTransfer): true
ReactEditor.insertTextData(editor: ReactEditor, data: DataTransfer): trueInsert text data from a DataTransfer into the editor. Returns true if some content has been effectively inserted.
ReactEditor.setFragmentData(editor: ReactEditor, data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut'): void
ReactEditor.setFragmentData(editor: ReactEditor, data: DataTransfer, originEvent?: 'drag' | 'copy' | 'cut'): voidSets data from the currently selected fragment on a DataTransfer.
Last updated