refactor(editor): remove global types in edgeless (#10092)

Closes: [BS-2553](https://linear.app/affine-design/issue/BS-2553/remove-global-types-in-edgeless)
This commit is contained in:
Saul-Mirone
2025-02-11 12:09:44 +00:00
parent 3062bd0771
commit dbf0f9dc20
45 changed files with 126 additions and 329 deletions

View File

@@ -34,12 +34,3 @@ export const AIChatBlockSchema = defineBlockSchema({
});
export class AIChatBlockModel extends GfxCompatible<AIChatProps>(BlockModel) {}
declare global {
// oxlint-disable-next-line @typescript-eslint/no-namespace
namespace BlockSuite {
interface EdgelessBlockModelMap {
'affine:embed-ai-chat': AIChatBlockModel;
}
}
}

View File

@@ -1,5 +1,6 @@
import type { getCopilotHistoriesQuery, RequestOptions } from '@affine/graphql';
import type { EditorHost } from '@blocksuite/affine/block-std';
import type { GfxModel } from '@blocksuite/affine/block-std/gfx';
import type { BlockModel } from '@blocksuite/affine/store';
import type { DocContext } from '../chat-panel/chat-context';
@@ -72,7 +73,7 @@ declare global {
// internal context
host: EditorHost;
models?: (BlockModel | BlockSuite.SurfaceElementModel)[];
models?: (BlockModel | GfxModel)[];
control: TrackerControl;
where: TrackerWhere;
}

View File

@@ -1,10 +1,11 @@
import { AIProvider } from '@affine/core/blocksuite/presets/ai';
import { mixpanel, track } from '@affine/track';
import type { EditorHost } from '@blocksuite/affine/block-std';
import type { GfxPrimitiveElementModel } from '@blocksuite/affine/block-std/gfx';
import type { BlockModel } from '@blocksuite/affine/store';
import { lowerCase, omit } from 'lodash-es';
type ElementModel = BlockSuite.SurfaceElementModel;
type ElementModel = GfxPrimitiveElementModel;
type AIActionEventName =
| 'AI action invoked'