MCPcopy Create free account
hub / github.com/editablejs/editable / getStore

Function getStore

packages/plugins/toolbar/src/inline/store.ts:15–25  ·  view source on GitHub ↗
(editor: Editable)

Source from the content-addressed store, hash-verified

13const EDITOR_TO_TOOLBAR_STORE = new WeakMap<Editable, UseBoundStore<StoreApi<ToolbarState>>>()
14
15const getStore = (editor: Editable) => {
16 let store = EDITOR_TO_TOOLBAR_STORE.get(editor)
17 if (!store) {
18 store = create<ToolbarState>(() => ({
19 items: [],
20 open: false,
21 }))
22 EDITOR_TO_TOOLBAR_STORE.set(editor, store)
23 }
24 return store
25}
26
27export const useInlineToolbarStore = (editor: Editable) => {
28 return React.useMemo(() => getStore(editor), [editor])

Callers 3

useInlineToolbarStoreFunction · 0.70
setOpenFunction · 0.70
setItemsFunction · 0.70

Calls 2

getMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…