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

Function getStore

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

Source from the content-addressed store, hash-verified

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

Callers 2

useToolbarStoreFunction · 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…