mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-29 00:06:09 +08:00
refactor(editor): cleanup dead code (#12072)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Simplified and removed several internal AI block extension files and utility functions, streamlining the codebase and reducing unused features. - Updated logic to access editor modes and controllers directly, removing reliance on DOM queries and certain abstractions. - Reduced and restructured effect type declarations for improved clarity. - **Bug Fixes** - Improved type safety in the editor component by explicitly typing queried elements. - **Chores** - Removed obsolete exports and internal functions with no impact on user-facing functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -3,7 +3,10 @@ import type { DefaultOpenProperty } from '@affine/core/components/doc-properties
|
||||
import type { DocTitle } from '@blocksuite/affine/fragments/doc-title';
|
||||
import type { DocMode, ReferenceParams } from '@blocksuite/affine/model';
|
||||
import { HighlightSelection } from '@blocksuite/affine/shared/selection';
|
||||
import { FeatureFlagService as BSFeatureFlagService } from '@blocksuite/affine/shared/services';
|
||||
import {
|
||||
DocModeProvider,
|
||||
FeatureFlagService as BSFeatureFlagService,
|
||||
} from '@blocksuite/affine/shared/services';
|
||||
import { GfxControllerIdentifier } from '@blocksuite/affine/std/gfx';
|
||||
import type { InlineEditor } from '@blocksuite/std/inline';
|
||||
import { effect } from '@preact/signals-core';
|
||||
@@ -293,19 +296,18 @@ export class Editor extends Entity {
|
||||
unsubs.push(subscription.unsubscribe.bind(subscription));
|
||||
|
||||
// ----- Presenting -----
|
||||
const edgelessPage = editorContainer.host?.querySelector(
|
||||
'affine-edgeless-root'
|
||||
);
|
||||
if (!edgelessPage) {
|
||||
const std = editorContainer.host?.std;
|
||||
const editorMode = std?.get(DocModeProvider)?.getEditorMode();
|
||||
if (!editorMode || editorMode !== 'edgeless' || !gfx) {
|
||||
this.isPresenting$.next(false);
|
||||
} else {
|
||||
this.isPresenting$.next(
|
||||
edgelessPage.gfx.tool.currentToolName$.peek() === 'frameNavigator'
|
||||
gfx.tool.currentToolName$.peek() === 'frameNavigator'
|
||||
);
|
||||
|
||||
const disposable = effect(() => {
|
||||
this.isPresenting$.next(
|
||||
edgelessPage.gfx.tool.currentToolName$.value === 'frameNavigator'
|
||||
gfx.tool.currentToolName$.value === 'frameNavigator'
|
||||
);
|
||||
});
|
||||
unsubs.push(disposable);
|
||||
|
||||
Reference in New Issue
Block a user