(editor: Editor)
| 9 | const EDITABLE_TO_FOCUSED_STORE = new WeakMap<Editor, UseBoundStore<StoreApi<ReadOnlyStore>>>() |
| 10 | |
| 11 | const getStore = (editor: Editor) => { |
| 12 | let store = EDITABLE_TO_FOCUSED_STORE.get(editor) |
| 13 | if (!store) { |
| 14 | store = create<ReadOnlyStore>(() => ({ |
| 15 | isReadOnly: false, |
| 16 | })) |
| 17 | EDITABLE_TO_FOCUSED_STORE.set(editor, store) |
| 18 | } |
| 19 | |
| 20 | return store |
| 21 | } |
| 22 | |
| 23 | export const useReadOnly = (): [boolean, (isReadOnly: boolean) => void] => { |
| 24 | const editor = useEditableStatic() |
no test coverage detected