forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Changelog - Updated slate.js to version 0.58.4 - Removed unused packages (immutable & slate-plain-serializer) - Simplified example (we don’t need to demonstrate the multi editor case anymore since this issue is now handled by slate internally) - Remove deprecated `KeyUtils` - Removed deprecated Components ## Related: - ianstormtaylor/slate#870
- Loading branch information
Showing
5 changed files
with
21 additions
and
68 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import Link from 'next/link' | ||
import NextEditor from '../components/NextEditor' | ||
import React, { useState, useMemo } from 'react' | ||
import { createEditor } from 'slate' | ||
import { Slate, Editable, withReact } from 'slate-react' | ||
import { withHistory } from 'slate-history' | ||
|
||
const IndexPage = (props) => { | ||
const IndexPage = () => { | ||
const [value, setValue] = useState(initialValue) | ||
const editor = useMemo(() => withHistory(withReact(createEditor())), []) | ||
return ( | ||
<> | ||
<Link href="/multiple"> | ||
<a>Go to multiple</a> | ||
</Link> | ||
<hr /> | ||
<NextEditor | ||
slateKey="someUniqueKey" | ||
defaultValue="This is editable plain text, just like a <textarea>!" | ||
/> | ||
</> | ||
<Slate editor={editor} value={value} onChange={(value) => setValue(value)}> | ||
<Editable placeholder="Enter some plain text..." /> | ||
</Slate> | ||
) | ||
} | ||
|
||
const initialValue = [ | ||
{ | ||
children: [ | ||
{ text: 'This is editable plain text, just like a <textarea>!' }, | ||
], | ||
}, | ||
] | ||
|
||
export default IndexPage |
This file was deleted.
Oops, something went wrong.