Download slate/packages/slate-react/src/hooks/use-read-only.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 323 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/packages/slate-react/src/hooks/use-read-only.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/slate/packages/slate-react/src/hooks/use-read-only.ts
-
curl -L -o use-read-only.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/slate/packages/slate-react/src/hooks/use-read-only.ts
323 Bytes
| import { createContext, useContext } from 'react' | |
| /** | |
| * A React context for sharing the `readOnly` state of the editor. | |
| */ | |
| export const ReadOnlyContext = createContext(false) | |
| /** | |
| * Get the current `readOnly` state of the editor. | |
| */ | |
| export const useReadOnly = (): boolean => { | |
| return useContext(ReadOnlyContext) | |
| } | |