mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 20:16:26 +08:00
feat: add useBlocksuiteEditor hooks (#5366)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { AffineEditorContainer } from '@blocksuite/presets';
|
||||
import { atom, type SetStateAction, useAtom } from 'jotai';
|
||||
|
||||
const editorContainerAtom = atom<AffineEditorContainer | null>(null);
|
||||
|
||||
export function useBlocksuiteEditor(): [
|
||||
AffineEditorContainer | null,
|
||||
React.Dispatch<SetStateAction<AffineEditorContainer | null>>,
|
||||
] {
|
||||
const [editorContainer, setEditorContainer] = useAtom(editorContainerAtom);
|
||||
|
||||
return [editorContainer, setEditorContainer];
|
||||
}
|
||||
Reference in New Issue
Block a user