7013a8c219
This PR fixes #29740 and updates the with-slate example to match slates latest version. [more info](https://docs.slatejs.org/walkthroughs/01-installing-slate) ## Bug - [x] Related issues linked using `fixes #number` ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
21 lines
597 B
JavaScript
21 lines
597 B
JavaScript
import { useState } from 'react'
|
|
import { createEditor } from 'slate'
|
|
import { Slate, Editable, withReact } from 'slate-react'
|
|
import { withHistory } from 'slate-history'
|
|
|
|
export default function IndexPage() {
|
|
const [editor] = useState(() => withReact(withHistory(createEditor())), [])
|
|
const [value, setValue] = useState([
|
|
{
|
|
children: [
|
|
{ text: 'This is editable plain text, just like a <textarea>!' },
|
|
],
|
|
},
|
|
])
|
|
|
|
return (
|
|
<Slate editor={editor} value={value} onChange={setValue}>
|
|
<Editable placeholder="Enter some plain text..." />
|
|
</Slate>
|
|
)
|
|
}
|