mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 20:16:26 +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:
@@ -1,4 +1,4 @@
|
||||
import type { ParagraphBlockModel } from '@blocksuite/affine-model';
|
||||
import { ParagraphBlockModel } from '@blocksuite/affine-model';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
|
||||
import { matchFlavours } from '../model/checker.js';
|
||||
@@ -15,7 +15,7 @@ export function calculateCollapsedSiblings(
|
||||
const collapsedEdgeIndex = children.findIndex((child, i) => {
|
||||
if (
|
||||
i > index &&
|
||||
matchFlavours(child, ['affine:paragraph']) &&
|
||||
matchFlavours(child, [ParagraphBlockModel]) &&
|
||||
child.type.startsWith('h')
|
||||
) {
|
||||
const modelLevel = parseInt(model.type.slice(1));
|
||||
@@ -46,7 +46,7 @@ export function getNearestHeadingBefore(
|
||||
for (let i = index - 1; i >= 0; i--) {
|
||||
const sibling = parent.children[i];
|
||||
if (
|
||||
matchFlavours(sibling, ['affine:paragraph']) &&
|
||||
matchFlavours(sibling, [ParagraphBlockModel]) &&
|
||||
sibling.type.startsWith('h')
|
||||
) {
|
||||
return sibling;
|
||||
|
||||
Reference in New Issue
Block a user