mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
chore: bump blocksuite (#7235)
## Features - https://github.com/toeverything/BlockSuite/pull/7340 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7334 @EYHN - https://github.com/toeverything/BlockSuite/pull/7339 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7328 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7324 @Flrande - https://github.com/toeverything/BlockSuite/pull/7297 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7318 @CatsJuice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/7343 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7345 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7341 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7342 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7329 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7337 @fundon - https://github.com/toeverything/BlockSuite/pull/7333 @fundon - https://github.com/toeverything/BlockSuite/pull/7326 @akumatus - https://github.com/toeverything/BlockSuite/pull/7325 @Flrande - https://github.com/toeverything/BlockSuite/pull/7323 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7312 @golok727 - https://github.com/toeverything/BlockSuite/pull/7317 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7319 @akumatus ## Refactor - https://github.com/toeverything/BlockSuite/pull/7327 @Flrande - https://github.com/toeverything/BlockSuite/pull/7320 @Flrande ## Misc - https://github.com/toeverything/BlockSuite/pull/7303 @fundon - https://github.com/toeverything/BlockSuite/pull/7321 @Saul-Mirone
This commit is contained in:
@@ -75,12 +75,12 @@
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/global": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/global": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/icons": "2.1.55",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/store": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/store": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@storybook/addon-actions": "^7.6.17",
|
||||
"@storybook/addon-essentials": "^7.6.17",
|
||||
"@storybook/addon-interactions": "^7.6.17",
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"@affine/graphql": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@affine/templates": "workspace:*",
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/global": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/global": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/icons": "2.1.55",
|
||||
"@blocksuite/inline": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/store": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/inline": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/store": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
"@dnd-kit/modifiers": "^7.0.0",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
|
||||
@@ -12,6 +12,7 @@ export async function buildShowcaseWorkspace(
|
||||
workspaceName: string
|
||||
) {
|
||||
const meta = await workspacesService.create(flavour, async docCollection => {
|
||||
docCollection.meta.initialize();
|
||||
docCollection.meta.setName(workspaceName);
|
||||
const blob = await (await fetch(onboardingUrl)).blob();
|
||||
|
||||
@@ -58,6 +59,7 @@ export async function createFirstAppData(workspacesService: WorkspacesService) {
|
||||
const workspaceMetadata = await workspacesService.create(
|
||||
WorkspaceFlavour.LOCAL,
|
||||
async workspace => {
|
||||
workspace.meta.initialize();
|
||||
workspace.meta.setName(DEFAULT_WORKSPACE_NAME);
|
||||
const page = workspace.createDoc();
|
||||
defaultPageId = page.id;
|
||||
|
||||
@@ -247,6 +247,7 @@ export const CreateWorkspaceModal = ({
|
||||
const { id } = await workspacesService.create(
|
||||
workspaceFlavour,
|
||||
async workspace => {
|
||||
workspace.meta.initialize();
|
||||
workspace.meta.setName(name);
|
||||
const page = workspace.createDoc();
|
||||
defaultDocId = page.id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { mixpanel } from '@affine/core/utils';
|
||||
import type { BlockSpec } from '@blocksuite/block-std';
|
||||
import type { RootService } from '@blocksuite/blocks';
|
||||
import type { RootService, TelemetryEventMap } from '@blocksuite/blocks';
|
||||
import {
|
||||
AffineCanvasTextFonts,
|
||||
EdgelessRootService,
|
||||
@@ -30,9 +30,12 @@ function withAffineRootService(Service: typeof RootService) {
|
||||
customLoadFonts(this);
|
||||
}
|
||||
|
||||
telemetryService = {
|
||||
track: (event: string, data: Record<string, unknown>) => {
|
||||
mixpanel.track(event, data);
|
||||
override telemetryService = {
|
||||
track: <T extends keyof TelemetryEventMap>(
|
||||
eventName: T,
|
||||
props: TelemetryEventMap[T]
|
||||
) => {
|
||||
mixpanel.track(eventName, props);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@ schema.register(AffineSchemas);
|
||||
beforeEach(async () => {
|
||||
vi.useFakeTimers({ toFake: ['requestIdleCallback'] });
|
||||
docCollection = new DocCollection({ id: 'test', schema });
|
||||
docCollection.meta.initialize();
|
||||
const initPage = async (page: Doc) => {
|
||||
page.load();
|
||||
expect(page).not.toBeNull();
|
||||
|
||||
@@ -9,12 +9,12 @@ export function useAllBlockSuiteDocMeta(
|
||||
docCollection: DocCollection
|
||||
): DocMeta[] {
|
||||
if (!weakMap.has(docCollection)) {
|
||||
const baseAtom = atom<DocMeta[]>(docCollection.meta.docMetas);
|
||||
const baseAtom = atom<DocMeta[]>([...docCollection.meta.docMetas]);
|
||||
weakMap.set(docCollection, baseAtom);
|
||||
baseAtom.onMount = set => {
|
||||
set(docCollection.meta.docMetas);
|
||||
set([...docCollection.meta.docMetas]);
|
||||
const dispose = docCollection.meta.docMetaUpdated.on(() => {
|
||||
set(docCollection.meta.docMetas);
|
||||
set([...docCollection.meta.docMetas]);
|
||||
});
|
||||
return () => {
|
||||
dispose.dispose();
|
||||
|
||||
@@ -6,10 +6,12 @@ import { useDocCollectionPage } from './use-block-suite-workspace-page';
|
||||
|
||||
const weakMap = new WeakMap<Doc, Atom<string[]>>();
|
||||
function getPageBacklinks(page: Doc): string[] {
|
||||
return page.collection.indexer.backlink
|
||||
.getBacklink(page.id)
|
||||
.map(linkNode => linkNode.pageId)
|
||||
.filter(id => id !== page.id);
|
||||
return (
|
||||
page.collection.indexer.backlink
|
||||
?.getBacklink(page.id)
|
||||
.map(linkNode => linkNode.pageId)
|
||||
.filter(id => id !== page.id) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
const getPageBacklinksAtom = (page: Doc | null) => {
|
||||
@@ -24,13 +26,13 @@ const getPageBacklinksAtom = (page: Doc | null) => {
|
||||
page.slots.ready.on(() => {
|
||||
set(getPageBacklinks(page));
|
||||
}),
|
||||
page.collection.indexer.backlink.slots.indexUpdated.on(() => {
|
||||
page.collection.indexer.backlink?.slots.indexUpdated.on(() => {
|
||||
set(getPageBacklinks(page));
|
||||
}),
|
||||
];
|
||||
set(getPageBacklinks(page));
|
||||
return () => {
|
||||
disposables.forEach(disposable => disposable.dispose());
|
||||
disposables.forEach(disposable => disposable?.dispose());
|
||||
};
|
||||
};
|
||||
weakMap.set(page, baseAtom);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useDocCollectionPage } from './use-block-suite-workspace-page';
|
||||
const weakMap = new WeakMap<Doc, Atom<string[]>>();
|
||||
function getPageReferences(page: Doc): string[] {
|
||||
return Object.values(
|
||||
page.collection.indexer.backlink.linkIndexMap[page.id] ?? {}
|
||||
page.collection.indexer.backlink?.linkIndexMap[page.id] ?? {}
|
||||
).flatMap(linkNodes => linkNodes.map(linkNode => linkNode.pageId));
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ const getPageReferencesAtom = (page: Doc | null) => {
|
||||
page.slots.ready.on(() => {
|
||||
set(getPageReferences(page));
|
||||
}),
|
||||
page.collection.indexer.backlink.slots.indexUpdated.on(() => {
|
||||
page.collection.indexer.backlink?.slots.indexUpdated.on(() => {
|
||||
set(getPageReferences(page));
|
||||
}),
|
||||
];
|
||||
set(getPageReferences(page));
|
||||
return () => {
|
||||
disposables.forEach(disposable => disposable.dispose());
|
||||
disposables.forEach(disposable => disposable?.dispose());
|
||||
};
|
||||
};
|
||||
weakMap.set(page, baseAtom);
|
||||
|
||||
@@ -23,6 +23,7 @@ export async function configureTestingEnvironment() {
|
||||
metadata: await workspaceManager.create(
|
||||
WorkspaceFlavour.LOCAL,
|
||||
async ws => {
|
||||
ws.meta.initialize();
|
||||
const initDoc = async (page: BlockSuiteDoc) => {
|
||||
page.load();
|
||||
const pageBlockId = page.addBlock('affine:page', {
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
"@affine/env": "workspace:*",
|
||||
"@affine/i18n": "workspace:*",
|
||||
"@affine/native": "workspace:*",
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/store": "0.15.0-canary-202406130805-4cefc62",
|
||||
"@blocksuite/block-std": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/blocks": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/presets": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@blocksuite/store": "0.15.0-canary-202406170818-d8a3bf5",
|
||||
"@electron-forge/cli": "^7.3.0",
|
||||
"@electron-forge/core": "^7.3.0",
|
||||
"@electron-forge/core-utils": "^7.3.0",
|
||||
|
||||
@@ -275,6 +275,7 @@ export enum ErrorNames {
|
||||
MISSING_OAUTH_QUERY_PARAMETER = 'MISSING_OAUTH_QUERY_PARAMETER',
|
||||
NOT_IN_WORKSPACE = 'NOT_IN_WORKSPACE',
|
||||
NO_COPILOT_PROVIDER_AVAILABLE = 'NO_COPILOT_PROVIDER_AVAILABLE',
|
||||
OAUTH_ACCOUNT_ALREADY_CONNECTED = 'OAUTH_ACCOUNT_ALREADY_CONNECTED',
|
||||
OAUTH_STATE_EXPIRED = 'OAUTH_STATE_EXPIRED',
|
||||
PAGE_IS_NOT_PUBLIC = 'PAGE_IS_NOT_PUBLIC',
|
||||
RUNTIME_CONFIG_NOT_FOUND = 'RUNTIME_CONFIG_NOT_FOUND',
|
||||
|
||||
Reference in New Issue
Block a user