1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-20 14:11:35 +02:00

Add Editable and event handling docs for Slate React

This commit is contained in:
Sunny Hirai
2023-04-12 22:44:50 -07:00
parent 76544747e8
commit 036d58fa98
4 changed files with 76 additions and 45 deletions

View File

@@ -0,0 +1,24 @@
# Editable component
#### `Editable(props: EditableProps)`
The `Editable` component is the main editing component. Note that it must be inside a `Slate` component.
It takes as its props, any props accepted by a Textarea element plus the following props.
```typescript
export type EditableProps = {
decorate?: (entry: NodeEntry) => Range[]
onDOMBeforeInput?: (event: InputEvent) => void
placeholder?: string
readOnly?: boolean
role?: string
style?: React.CSSProperties
renderElement?: (props: RenderElementProps) => JSX.Element
renderLeaf?: (props: RenderLeafProps) => JSX.Element
renderPlaceholder?: (props: RenderPlaceholderProps) => JSX.Element
scrollSelectionIntoView?: (editor: ReactEditor, domRange: DOMRange) => void
as?: React.ElementType
disableDefaultStyles?: boolean
} & React.TextareaHTMLAttributes<HTMLDivElement>
```