refactor(editor): remove legacy blocksuite doc (#9521)

This commit is contained in:
Saul-Mirone
2025-01-05 01:25:59 +00:00
parent 1f1997a082
commit be0de6dc21
12 changed files with 43 additions and 108 deletions

View File

@@ -11,10 +11,7 @@ import { WorkspaceService } from '@affine/core/modules/workspace';
import { i18nTime, Trans, useI18n } from '@affine/i18n';
import { track } from '@affine/track';
import type { DocMode } from '@blocksuite/affine/blocks';
import type {
Blocks as BlockSuiteDoc,
Workspace,
} from '@blocksuite/affine/store';
import type { Blocks, Workspace } from '@blocksuite/affine/store';
import { CloseIcon, ToggleCollapseIcon } from '@blocksuite/icons/rc';
import * as Collapsible from '@radix-ui/react-collapsible';
import type { DialogContentProps } from '@radix-ui/react-dialog';
@@ -90,7 +87,7 @@ const ModalContainer = ({
interface HistoryEditorPreviewProps {
ts?: string;
historyList: HistoryList;
snapshotPage?: BlockSuiteDoc;
snapshotPage?: Blocks;
mode: DocMode;
onModeChange: (mode: DocMode) => void;
title: string;

View File

@@ -1,5 +1,5 @@
import type { Blocks } from '@blocksuite/affine/store';
import type { Map as YMap } from 'yjs';
import type { Doc as YDoc, Map as YMap } from 'yjs';
/**
* TODO(@eyhn): Define error to unexpected state together in the future.
@@ -9,9 +9,9 @@ export class NoPageRootError extends Error {
super('Page root not found when render editor!');
// Log info to let sentry collect more message
const hasExpectSpace = Array.from(page.rootDoc.spaces.values()).some(
doc => page.spaceDoc.guid === doc.guid
);
const hasExpectSpace = Array.from(
page.rootDoc.getMap<YDoc>('spaces').values()
).some(doc => page.spaceDoc.guid === doc.guid);
const blocks = page.spaceDoc.getMap('blocks') as YMap<YMap<any>>;
const havePageBlock = Array.from(blocks.values()).some(
block => block.get('sys:flavour') === 'affine:page'