Download slate/site/examples/js/read-only.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/site/examples/js/read-only.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/site/examples/js/read-only.jsx
-
curl -L -o read-only.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/site/examples/js/read-only.jsx
613 Bytes
| import React, { useMemo } from 'react' | |
| import { createEditor } from 'slate' | |
| import { Slate, Editable, withReact } from 'slate-react' | |
| const ReadOnlyExample = () => { | |
| const editor = useMemo(() => withReact(createEditor()), []) | |
| return ( | |
| <Slate editor={editor} initialValue={initialValue}> | |
| <Editable readOnly placeholder="Enter some plain text..." /> | |
| </Slate> | |
| ) | |
| } | |
| const initialValue = [ | |
| { | |
| type: 'paragraph', | |
| children: [ | |
| { | |
| text: 'This example shows what happens when the Editor is set to readOnly, it is not editable', | |
| }, | |
| ], | |
| }, | |
| ] | |
| export default ReadOnlyExample | |