refactor(editor): remove block models global type (#10086)

This commit is contained in:
Saul-Mirone
2025-02-11 11:00:57 +00:00
parent a725df6ebe
commit 39eb8625d6
157 changed files with 402 additions and 621 deletions
@@ -1,6 +1,9 @@
import { EditPropsStore } from '@blocksuite/affine-shared/services';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
import {
GfxControllerIdentifier,
type GfxModel,
} from '@blocksuite/block-std/gfx';
import { type Container, createIdentifier } from '@blocksuite/global/di';
import { type BlockModel, Extension } from '@blocksuite/store';
@@ -30,7 +33,7 @@ export class EdgelessCRUDExtension extends Extension {
return this._gfx.surface as SurfaceBlockModel | null;
}
deleteElements = (elements: BlockSuite.EdgelessModel[]) => {
deleteElements = (elements: GfxModel[]) => {
const surface = this._surface;
if (!surface) {
console.error('surface is not initialized');
@@ -134,7 +137,7 @@ export class EdgelessCRUDExtension extends Extension {
}
};
getElementById(id: string): BlockSuite.EdgelessModel | null {
getElementById(id: string): GfxModel | null {
const surface = this._surface;
if (!surface) {
return null;
@@ -1,16 +1,17 @@
import type { NoteBlockModel } from '@blocksuite/affine-model';
import type { GfxModel } from '@blocksuite/block-std/gfx';
import type { BlockModel } from '@blocksuite/store';
import type { Connectable } from '../managers/connector-manager';
export function isConnectable(
element: BlockSuite.EdgelessModel | null
element: GfxModel | null
): element is Connectable {
return !!element && element.connectable;
}
export function isNoteBlock(
element: BlockModel | BlockSuite.EdgelessModel | null
element: BlockModel | GfxModel | null
): element is NoteBlockModel {
return !!element && 'flavour' in element && element.flavour === 'affine:note';
}