mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat!: upgrade blocksuite version (#2833)
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
import type { BlockSuiteFeatureFlags } from '@affine/env';
|
||||
import { config } from '@affine/env';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import {
|
||||
createAffineProviders,
|
||||
createLocalProviders,
|
||||
} from '@affine/workspace/providers';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import type { Generator, StoreOptions } from '@blocksuite/store';
|
||||
import type {
|
||||
DocProviderCreator,
|
||||
Generator,
|
||||
StoreOptions,
|
||||
} from '@blocksuite/store';
|
||||
import { createIndexeddbStorage, Workspace } from '@blocksuite/store';
|
||||
import { rootStore } from '@toeverything/plugin-infra/manager';
|
||||
|
||||
@@ -67,6 +75,7 @@ export function createEmptyBlockSuiteWorkspace(
|
||||
) {
|
||||
throw new Error('workspaceApis is required for affine flavour');
|
||||
}
|
||||
const providerCreators: DocProviderCreator[] = [];
|
||||
const prefix: string = config?.cachePrefix ?? '';
|
||||
const cacheKey = `${prefix}${id}`;
|
||||
if (hashMap.has(cacheKey)) {
|
||||
@@ -81,6 +90,7 @@ export function createEmptyBlockSuiteWorkspace(
|
||||
const workspaceApis = config.workspaceApis;
|
||||
blobStorages.push(id => createAffineBlobStorage(id, workspaceApis));
|
||||
}
|
||||
providerCreators.push(...createAffineProviders());
|
||||
} else {
|
||||
if (typeof window !== 'undefined') {
|
||||
blobStorages.push(createIndexeddbStorage);
|
||||
@@ -88,11 +98,13 @@ export function createEmptyBlockSuiteWorkspace(
|
||||
blobStorages.push(createSQLiteStorage);
|
||||
}
|
||||
}
|
||||
providerCreators.push(...createLocalProviders());
|
||||
}
|
||||
|
||||
const workspace = new Workspace({
|
||||
id,
|
||||
isSSR: typeof window === 'undefined',
|
||||
providerCreators: typeof window === 'undefined' ? [] : providerCreators,
|
||||
blobStorages: blobStorages,
|
||||
idGenerator,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user