(editor: Editable)
| 33 | const EDITOR_TO_TOOLBAR_STORE = new WeakMap<Editable, UseBoundStore<StoreApi<ToolbarState>>>() |
| 34 | |
| 35 | const 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 | |
| 48 | export const useSideToolbarStore = (editor: Editable) => { |
| 49 | return React.useMemo(() => getStore(editor), [editor]) |
no test coverage detected
searching dependent graphs…