MCPcopy Index your code
hub / github.com/editablejs/editable / getStore

Function getStore

packages/editor/src/hooks/use-read-only.ts:11–21  ·  view source on GitHub ↗
(editor: Editor)

Source from the content-addressed store, hash-verified

9const EDITABLE_TO_FOCUSED_STORE = new WeakMap<Editor, UseBoundStore<StoreApi<ReadOnlyStore>>>()
10
11const 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
23export const useReadOnly = (): [boolean, (isReadOnly: boolean) => void] => {
24 const editor = useEditableStatic()

Callers 2

useReadOnlyFunction · 0.70
use-read-only.tsFile · 0.70

Calls 2

getMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected