mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-05 03:19:52 +08:00
refactor(editor): remove block models global type (#10086)
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user