mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
refactor(editor): remove global types in model (#10082)
Closes: [BS-2249](https://linear.app/affine-design/issue/BS-2249/remove-global-types-in-model) ```ts // before matchFlavours(model, ['affine:page']); // after matchFlavours(model, [PageBlockModel]); ```
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
BookmarkStyles,
|
||||
DEFAULT_NOTE_HEIGHT,
|
||||
DEFAULT_NOTE_WIDTH,
|
||||
FrameBlockModel,
|
||||
MAX_IMAGE_WIDTH,
|
||||
ReferenceInfoSchema,
|
||||
} from '@blocksuite/affine-model';
|
||||
@@ -994,7 +995,7 @@ export class EdgelessClipboardController extends PageClipboard {
|
||||
for (const nodeElement of nodeElements) {
|
||||
await _drawTopLevelBlock(nodeElement);
|
||||
|
||||
if (matchFlavours(nodeElement, ['affine:frame'])) {
|
||||
if (matchFlavours(nodeElement, [FrameBlockModel])) {
|
||||
const blocksInsideFrame: BlockSuite.EdgelessBlockModelType[] = [];
|
||||
this.edgeless.service.frame
|
||||
.getElementsInFrameBound(nodeElement, false)
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
GroupElementModel,
|
||||
LayoutType,
|
||||
MindmapElementModel,
|
||||
NoteBlockModel,
|
||||
NoteDisplayMode,
|
||||
type ShapeElementModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
@@ -134,7 +135,7 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
|
||||
selection.selectedElements.length === 1 &&
|
||||
selection.firstElement instanceof GfxBlockElementModel &&
|
||||
matchFlavours(selection.firstElement as GfxBlockElementModel, [
|
||||
'affine:note',
|
||||
NoteBlockModel,
|
||||
])
|
||||
) {
|
||||
rootComponent.slots.toggleNoteSlicer.emit();
|
||||
@@ -259,7 +260,7 @@ export class EdgelessPageKeyboardManager extends PageKeyboardManager {
|
||||
block =>
|
||||
block.group === null &&
|
||||
!(
|
||||
matchFlavours(block, ['affine:note']) &&
|
||||
matchFlavours(block, [NoteBlockModel]) &&
|
||||
block.displayMode === NoteDisplayMode.DocOnly
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
normalizeWheelDeltaY,
|
||||
} from '@blocksuite/affine-block-surface';
|
||||
import {
|
||||
type NoteBlockModel,
|
||||
NoteBlockModel,
|
||||
NoteDisplayMode,
|
||||
type RootBlockModel,
|
||||
type ShapeElementModel,
|
||||
@@ -350,7 +350,7 @@ export class EdgelessRootBlockComponent extends BlockComponent<
|
||||
const primaryMode = std.get(DocModeProvider).getPrimaryMode(this.doc.id);
|
||||
const note = this.model.children.find(
|
||||
(child): child is NoteBlockModel =>
|
||||
matchFlavours(child, ['affine:note']) &&
|
||||
matchFlavours(child, [NoteBlockModel]) &&
|
||||
child.displayMode !== NoteDisplayMode.EdgelessOnly
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user