mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-22 12:32:00 +08:00
Merge branch 'feat/filesystem_and_search' of https://github.com/toeverything/AFFiNE into feat/filesystem_and_search
This commit is contained in:
@@ -13,7 +13,7 @@ import { Workspace, WorkspaceType } from '@pathfinder/data-services';
|
|||||||
import { useAppState } from '@/providers/app-state-provider';
|
import { useAppState } from '@/providers/app-state-provider';
|
||||||
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
|
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
|
||||||
import { WorkspaceDelete } from './delete';
|
import { WorkspaceDelete } from './delete';
|
||||||
import { Workspace as StoreWorkspaces } from '@blocksuite/store';
|
import { Workspace as StoreWorkspace } from '@blocksuite/store';
|
||||||
import { debounce } from '@/utils';
|
import { debounce } from '@/utils';
|
||||||
|
|
||||||
export const GeneralPage = ({
|
export const GeneralPage = ({
|
||||||
@@ -22,7 +22,7 @@ export const GeneralPage = ({
|
|||||||
}: {
|
}: {
|
||||||
workspace: Workspace;
|
workspace: Workspace;
|
||||||
owner: WorkspaceDetails[string]['owner'];
|
owner: WorkspaceDetails[string]['owner'];
|
||||||
workspaces: Record<string, StoreWorkspaces | null>;
|
workspaces: Record<string, StoreWorkspace | null>;
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
user,
|
user,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { Page } from '@blocksuite/store';
|
|||||||
import {
|
import {
|
||||||
// createWebsocketDocProvider,
|
// createWebsocketDocProvider,
|
||||||
IndexedDBDocProvider,
|
IndexedDBDocProvider,
|
||||||
Workspace,
|
Workspace as StoreWorkspace,
|
||||||
} from '@blocksuite/store';
|
} from '@blocksuite/store';
|
||||||
import '@blocksuite/blocks';
|
import '@blocksuite/blocks';
|
||||||
import '@blocksuite/blocks/style';
|
import '@blocksuite/blocks/style';
|
||||||
@@ -31,7 +31,7 @@ const DynamicBlocksuite = ({
|
|||||||
) =>
|
) =>
|
||||||
// eslint-disable-next-line no-async-promise-executor
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
new Promise(async resolve => {
|
new Promise(async resolve => {
|
||||||
const workspace = new Workspace({
|
const workspace = new StoreWorkspace({
|
||||||
room: workspaceId,
|
room: workspaceId,
|
||||||
providers: [],
|
providers: [],
|
||||||
}).register(BlockSchema);
|
}).register(BlockSchema);
|
||||||
@@ -66,7 +66,7 @@ const DynamicBlocksuite = ({
|
|||||||
);
|
);
|
||||||
const updates = await downloadWorkspace({ workspaceId });
|
const updates = await downloadWorkspace({ workspaceId });
|
||||||
updates &&
|
updates &&
|
||||||
Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
|
StoreWorkspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
|
||||||
// if after update, the space:meta is empty, then we need to get map with doc
|
// if after update, the space:meta is empty, then we need to get map with doc
|
||||||
workspace.doc.getMap('space:meta');
|
workspace.doc.getMap('space:meta');
|
||||||
if (indexDBProvider) {
|
if (indexDBProvider) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import type {
|
|||||||
CreateEditorHandler,
|
CreateEditorHandler,
|
||||||
LoadWorkspaceHandler,
|
LoadWorkspaceHandler,
|
||||||
} from './context';
|
} from './context';
|
||||||
import { Page, Workspace } from '@blocksuite/store';
|
import { Page, Workspace as StoreWorkspace } from '@blocksuite/store';
|
||||||
import { EditorContainer } from '@blocksuite/editor';
|
import { EditorContainer } from '@blocksuite/editor';
|
||||||
const DynamicBlocksuite = dynamic(() => import('./dynamic-blocksuite'), {
|
const DynamicBlocksuite = dynamic(() => import('./dynamic-blocksuite'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@@ -49,7 +49,10 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
|||||||
if (workspace) {
|
if (workspace) {
|
||||||
const updates = await downloadWorkspace({ workspaceId });
|
const updates = await downloadWorkspace({ workspaceId });
|
||||||
updates &&
|
updates &&
|
||||||
Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
|
StoreWorkspace.Y.applyUpdate(
|
||||||
|
workspace.doc,
|
||||||
|
new Uint8Array(updates)
|
||||||
|
);
|
||||||
// if after update, the space:meta is empty, then we need to get map with doc
|
// if after update, the space:meta is empty, then we need to get map with doc
|
||||||
workspace.doc.getMap('space:meta');
|
workspace.doc.getMap('space:meta');
|
||||||
}
|
}
|
||||||
@@ -65,7 +68,7 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
|||||||
return { id, workspace };
|
return { id, workspace };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
const workspaces: Record<string, Workspace | null> = {};
|
const workspaces: Record<string, StoreWorkspace | null> = {};
|
||||||
workspacesList.forEach(({ id, workspace }) => {
|
workspacesList.forEach(({ id, workspace }) => {
|
||||||
workspaces[id] = workspace;
|
workspaces[id] = workspace;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user