From 9dc1b5e25b234e842b0635cf1ab7be7c8137741d Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Tue, 31 Dec 2024 06:32:12 +0000 Subject: [PATCH] refactor(editor): remove duplicated method (#9451) --- blocksuite/blocks/src/_common/edgeless/mindmap/index.ts | 6 ------ .../edgeless/components/rects/edgeless-selected-rect.ts | 2 +- .../gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts | 6 ++---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/blocksuite/blocks/src/_common/edgeless/mindmap/index.ts b/blocksuite/blocks/src/_common/edgeless/mindmap/index.ts index 92d61c208d108..663c0c3e4aa91 100644 --- a/blocksuite/blocks/src/_common/edgeless/mindmap/index.ts +++ b/blocksuite/blocks/src/_common/edgeless/mindmap/index.ts @@ -1,12 +1,6 @@ import { MindmapElementModel } from '@blocksuite/affine-model'; import type { Viewport } from '@blocksuite/block-std/gfx'; -export function isMindmapNode(el: BlockSuite.EdgelessModel) { - return ( - el.group instanceof MindmapElementModel || el instanceof MindmapElementModel - ); -} - export function isSingleMindMapNode(els: BlockSuite.EdgelessModel[]) { return els.length === 1 && els[0].group instanceof MindmapElementModel; } diff --git a/blocksuite/blocks/src/root-block/edgeless/components/rects/edgeless-selected-rect.ts b/blocksuite/blocks/src/root-block/edgeless/components/rects/edgeless-selected-rect.ts index 8b35c531b3f3f..8f447453b52c8 100644 --- a/blocksuite/blocks/src/root-block/edgeless/components/rects/edgeless-selected-rect.ts +++ b/blocksuite/blocks/src/root-block/edgeless/components/rects/edgeless-selected-rect.ts @@ -62,7 +62,6 @@ import { state } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { styleMap } from 'lit/directives/style-map.js'; -import { isMindmapNode } from '../../../../_common/edgeless/mindmap/index.js'; import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js'; import type { EdgelessFrameManager, @@ -91,6 +90,7 @@ import { isEmbedYoutubeBlock, isFrameBlock, isImageBlock, + isMindmapNode, isNoteBlock, } from '../../utils/query.js'; import { diff --git a/blocksuite/blocks/src/root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts b/blocksuite/blocks/src/root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts index c1343bbd3776c..26761d0dda137 100644 --- a/blocksuite/blocks/src/root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts +++ b/blocksuite/blocks/src/root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/mind-map-ext.ts @@ -18,10 +18,8 @@ import { } from '@blocksuite/block-std/gfx'; import type { Bound, IVec } from '@blocksuite/global/utils'; -import { - isMindmapNode, - isSingleMindMapNode, -} from '../../../../../_common/edgeless/mindmap/index.js'; +import { isSingleMindMapNode } from '../../../../../_common/edgeless/mindmap/index.js'; +import { isMindmapNode } from '../../../utils/query.js'; import { DefaultModeDragType, DefaultToolExt, type DragState } from '../ext.js'; import { calculateResponseArea } from './drag-utils.js'; import type { MindMapIndicatorOverlay } from './indicator-overlay.js';