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

Function getStore

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

Source from the content-addressed store, hash-verified

33const EDITOR_TO_TOOLBAR_STORE = new WeakMap<Editable, UseBoundStore<StoreApi<ToolbarState>>>()
34
35const getStore = (editor: Editable) => {
36 let store = EDITOR_TO_TOOLBAR_STORE.get(editor)
37 if (!store) {
38 store = create<ToolbarState>(() => ({
39 items: [],
40 menuOpen: false,
41 decorateOpen: false,
42 }))
43 EDITOR_TO_TOOLBAR_STORE.set(editor, store)
44 }
45 return store
46}
47
48export const useSideToolbarStore = (editor: Editable) => {
49 return React.useMemo(() => getStore(editor), [editor])

Callers 4

useSideToolbarStoreFunction · 0.70
setOpenFunction · 0.70
setItemsFunction · 0.70
setDecorateOpenFunction · 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…