(editor: Editable)
| 13 | const EDITOR_TO_TOOLBAR_STORE = new WeakMap<Editable, UseBoundStore<StoreApi<ToolbarState>>>() |
| 14 | |
| 15 | const 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 | |
| 27 | export const useInlineToolbarStore = (editor: Editable) => { |
| 28 | return React.useMemo(() => getStore(editor), [editor]) |
no test coverage detected
searching dependent graphs…