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
@@ -8,7 +8,7 @@ import {
getClosestBlockComponentByElement,
getRectByBlockComponent,
} from '../dom/index.js';
import { matchFlavours } from '../model/index.js';
import { matchModels } from '../model/index.js';
import { getDropRectByPoint } from './get-drop-rect-by-point.js';
import { DropFlags, type DropPlacement, type DropTarget } from './types.js';
@@ -56,7 +56,7 @@ export function calcDropTarget(
.every(m => children.includes(m.flavour));
}
if (!shouldAppendToDatabase && !matchFlavours(model, [DatabaseBlockModel])) {
if (!shouldAppendToDatabase && !matchModels(model, [DatabaseBlockModel])) {
const databaseBlockComponent =
element.closest<BlockComponent>('affine-database');
if (databaseBlockComponent) {
@@ -150,7 +150,7 @@ export function calcDropTarget(
const hasChild = (element as BlockComponent).childBlocks.length;
if (
allowSublist &&
matchFlavours(model, [ListBlockModel]) &&
matchModels(model, [ListBlockModel]) &&
!hasChild &&
point.x > domRect.x + BLOCK_CHILDREN_CONTAINER_PADDING_LEFT
) {
@@ -4,7 +4,7 @@ import type { Point } from '@blocksuite/global/utils';
import type { BlockModel } from '@blocksuite/store';
import { getRectByBlockComponent } from '../dom/index.js';
import { matchFlavours } from '../model/index.js';
import { matchModels } from '../model/index.js';
import { DropFlags } from './types.js';
const ATTR_SELECTOR = `[${BLOCK_ID_ATTR}]`;
@@ -25,7 +25,7 @@ export function getDropRectByPoint(
flag: DropFlags.Normal,
};
const isDatabase = matchFlavours(model, [DatabaseBlockModel]);
const isDatabase = matchModels(model, [DatabaseBlockModel]);
if (isDatabase) {
const table = getDatabaseBlockTableElement(element);