mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat: modify blockhub & help island interation (#960)
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
@@ -44,6 +44,7 @@ export const AppStateProvider = ({
|
||||
pageList: [],
|
||||
currentPage: null,
|
||||
editor: null,
|
||||
blockHub: null,
|
||||
synced: true,
|
||||
isOwner: false,
|
||||
});
|
||||
@@ -127,6 +128,7 @@ export const AppStateProvider = ({
|
||||
pageList: pageList,
|
||||
currentPage: null,
|
||||
editor: null,
|
||||
blockHub: null,
|
||||
isOwner,
|
||||
});
|
||||
|
||||
@@ -161,6 +163,14 @@ export const AppStateProvider = ({
|
||||
editor,
|
||||
});
|
||||
};
|
||||
const setBlockHub: AppStateFunction['setBlockHub'] =
|
||||
useRef() as AppStateFunction['setBlockHub'];
|
||||
setBlockHub.current = blockHub => {
|
||||
setAppState({
|
||||
...appState,
|
||||
blockHub,
|
||||
});
|
||||
};
|
||||
|
||||
const login = async () => {
|
||||
const { dataCenter } = appState;
|
||||
@@ -184,6 +194,7 @@ export const AppStateProvider = ({
|
||||
value={{
|
||||
...appState,
|
||||
setEditor,
|
||||
setBlockHub,
|
||||
loadPage: loadPage.current,
|
||||
loadWorkspace: loadWorkspace,
|
||||
login,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DataCenter, User, WorkspaceUnit } from '@affine/datacenter';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import { BlockHub } from '@blocksuite/blocks';
|
||||
|
||||
import type {
|
||||
Page as StorePage,
|
||||
@@ -22,6 +23,7 @@ export type AppStateValue = {
|
||||
pageList: PageMeta[];
|
||||
currentPage: StorePage | null;
|
||||
editor?: EditorContainer | null;
|
||||
blockHub?: BlockHub | null;
|
||||
synced: boolean;
|
||||
isOwner?: boolean;
|
||||
blobDataSynced?: boolean;
|
||||
@@ -29,6 +31,7 @@ export type AppStateValue = {
|
||||
|
||||
export type AppStateFunction = {
|
||||
setEditor: MutableRefObject<(page: EditorContainer) => void>;
|
||||
setBlockHub: MutableRefObject<(BlockHub: BlockHub) => void>;
|
||||
|
||||
loadWorkspace: MutableRefObject<
|
||||
(workspaceId: string) => Promise<WorkspaceUnit | null>
|
||||
|
||||
Reference in New Issue
Block a user