mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
refactor(editor): remove block models global type (#10086)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { MindmapElementModel } from '@blocksuite/affine-model';
|
||||
import type { Viewport } from '@blocksuite/block-std/gfx';
|
||||
import type { GfxModel, Viewport } from '@blocksuite/block-std/gfx';
|
||||
|
||||
export function isSingleMindMapNode(els: BlockSuite.EdgelessModel[]) {
|
||||
export function isSingleMindMapNode(els: GfxModel[]) {
|
||||
return els.length === 1 && els[0].group instanceof MindmapElementModel;
|
||||
}
|
||||
|
||||
export function isElementOutsideViewport(
|
||||
viewport: Viewport,
|
||||
element: BlockSuite.EdgelessModel,
|
||||
element: GfxModel,
|
||||
padding: [number, number] = [0, 0]
|
||||
) {
|
||||
const elementBound = element.elementBound;
|
||||
@@ -25,7 +25,7 @@ export function isElementOutsideViewport(
|
||||
|
||||
export function getNearestTranslation(
|
||||
viewport: Viewport,
|
||||
element: BlockSuite.EdgelessModel,
|
||||
element: GfxModel,
|
||||
padding: [number, number] = [0, 0]
|
||||
) {
|
||||
const viewportBound = viewport.viewportBounds;
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
isInsidePageEditor,
|
||||
matchFlavours,
|
||||
matchModels,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
type BlockStdScope,
|
||||
@@ -458,7 +458,7 @@ export class ExportManager {
|
||||
edgeless?.service.gfx.getElementsByBound(bound, { type: 'block' }) ??
|
||||
[];
|
||||
for (const block of blocks) {
|
||||
if (matchFlavours(block, [ImageBlockModel])) {
|
||||
if (matchModels(block, [ImageBlockModel])) {
|
||||
if (!block.sourceId) return;
|
||||
|
||||
const blob = await block.doc.blobSync.get(block.sourceId);
|
||||
@@ -495,7 +495,7 @@ export class ExportManager {
|
||||
);
|
||||
}
|
||||
|
||||
if (matchFlavours(block, [FrameBlockModel])) {
|
||||
if (matchModels(block, [FrameBlockModel])) {
|
||||
// TODO(@L-Sun): use children of frame instead of bound
|
||||
const blocksInsideFrame = getBlocksInFrameBound(this.doc, block, false);
|
||||
const frameBound = Bound.deserialize(block.xywh);
|
||||
|
||||
@@ -4,6 +4,7 @@ import type {
|
||||
DocMode,
|
||||
GroupElementModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||
import type { Store } from '@blocksuite/store';
|
||||
|
||||
export type AbstractEditor = {
|
||||
@@ -12,6 +13,6 @@ export type AbstractEditor = {
|
||||
} & HTMLElement;
|
||||
|
||||
export type Connectable = Exclude<
|
||||
BlockSuite.EdgelessModel,
|
||||
GfxModel,
|
||||
ConnectorElementModel | BrushElementModel | GroupElementModel
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user