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