diff --git a/blocksuite/affine/block-bookmark/src/commands/index.ts b/blocksuite/affine/block-bookmark/src/commands/index.ts index 4772254a2b6eb..db4864967fd37 100644 --- a/blocksuite/affine/block-bookmark/src/commands/index.ts +++ b/blocksuite/affine/block-bookmark/src/commands/index.ts @@ -1,7 +1,9 @@ import type { BlockCommands } from '@blocksuite/block-std'; import { insertBookmarkCommand } from './insert-bookmark.js'; +import { insertLinkByQuickSearchCommand } from './insert-link-by-quick-search.js'; export const commands: BlockCommands = { insertBookmark: insertBookmarkCommand, + insertLinkByQuickSearch: insertLinkByQuickSearchCommand, }; diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-link-by-quick-search.ts b/blocksuite/affine/block-bookmark/src/commands/insert-link-by-quick-search.ts similarity index 86% rename from blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-link-by-quick-search.ts rename to blocksuite/affine/block-bookmark/src/commands/insert-link-by-quick-search.ts index a5e88880e0b31..a4539f4da8998 100644 --- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-link-by-quick-search.ts +++ b/blocksuite/affine/block-bookmark/src/commands/insert-link-by-quick-search.ts @@ -1,10 +1,7 @@ +import type { InsertedLinkType } from '@blocksuite/affine-block-embed'; import { QuickSearchProvider } from '@blocksuite/affine-shared/services'; import type { Command } from '@blocksuite/block-std'; -export type InsertedLinkType = { - flavour?: 'affine:bookmark' | 'affine:embed-linked-doc'; -} | null; - export const insertLinkByQuickSearchCommand: Command< never, 'insertedLinkType' @@ -34,7 +31,6 @@ export const insertLinkByQuickSearchCommand: Command< // add normal link; if ('externalUrl' in result) { - // @ts-expect-error FIXME: fix after bookmark refactor std.command.exec('insertBookmark', { url: result.externalUrl }); return { flavour: 'affine:bookmark', diff --git a/blocksuite/affine/block-bookmark/src/effects.ts b/blocksuite/affine/block-bookmark/src/effects.ts index e9fda16a41b07..ea1c9c407ba2f 100644 --- a/blocksuite/affine/block-bookmark/src/effects.ts +++ b/blocksuite/affine/block-bookmark/src/effects.ts @@ -2,6 +2,7 @@ import { BookmarkBlockComponent } from './bookmark-block'; import { BookmarkEdgelessBlockComponent } from './bookmark-edgeless-block'; import type { BookmarkBlockService } from './bookmark-service'; import type { insertBookmarkCommand } from './commands/insert-bookmark'; +import type { insertLinkByQuickSearchCommand } from './commands/insert-link-by-quick-search'; import { BookmarkCard } from './components/bookmark-card'; export function effects() { @@ -17,6 +18,7 @@ declare global { namespace BlockSuite { interface Commands { insertBookmark: typeof insertBookmarkCommand; + insertLinkByQuickSearch: typeof insertLinkByQuickSearchCommand; } interface BlockServices { 'affine:bookmark': BookmarkBlockService; diff --git a/blocksuite/affine/block-embed/src/effects.ts b/blocksuite/affine/block-embed/src/effects.ts index df55e512a5b42..c654f0fe45c05 100644 --- a/blocksuite/affine/block-embed/src/effects.ts +++ b/blocksuite/affine/block-embed/src/effects.ts @@ -12,11 +12,10 @@ import { EmbedHtmlBlockComponent } from './embed-html-block'; import { EmbedHtmlFullscreenToolbar } from './embed-html-block/components/fullscreen-toolbar'; import { EmbedEdgelessHtmlBlockComponent } from './embed-html-block/embed-edgeless-html-block'; import { EmbedLinkedDocBlockComponent } from './embed-linked-doc-block'; -import type { insertEmbedLinkedDocCommand } from './embed-linked-doc-block/commands/insert-embed-linked-doc'; import type { InsertedLinkType, - insertLinkByQuickSearchCommand, -} from './embed-linked-doc-block/commands/insert-link-by-quick-search'; + insertEmbedLinkedDocCommand, +} from './embed-linked-doc-block/commands/insert-embed-linked-doc'; import { EmbedEdgelessLinkedDocBlockComponent } from './embed-linked-doc-block/embed-edgeless-linked-doc-block'; import type { EmbedLinkedDocBlockConfig } from './embed-linked-doc-block/embed-linked-doc-config'; import { @@ -121,15 +120,14 @@ declare global { 'affine:embed-loom': EmbedLoomBlockService; 'affine:embed-youtube': EmbedYoutubeBlockService; } - interface BlockConfigs { - 'affine:embed-linked-doc': EmbedLinkedDocBlockConfig; - } interface CommandContext { insertedLinkType?: Promise; } + interface BlockConfigs { + 'affine:embed-linked-doc': EmbedLinkedDocBlockConfig; + } interface Commands { insertEmbedLinkedDoc: typeof insertEmbedLinkedDocCommand; - insertLinkByQuickSearch: typeof insertLinkByQuickSearchCommand; } } } diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/index.ts b/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/index.ts index c9e47896582f2..e7e81fb6ea69e 100644 --- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/index.ts +++ b/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/index.ts @@ -1,9 +1,9 @@ import type { BlockCommands } from '@blocksuite/block-std'; import { insertEmbedLinkedDocCommand } from './insert-embed-linked-doc.js'; -import { insertLinkByQuickSearchCommand } from './insert-link-by-quick-search.js'; export const commands: BlockCommands = { insertEmbedLinkedDoc: insertEmbedLinkedDocCommand, - insertLinkByQuickSearch: insertLinkByQuickSearchCommand, }; + +export type { InsertedLinkType } from './insert-embed-linked-doc'; diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-embed-linked-doc.ts b/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-embed-linked-doc.ts index 917557f233399..e4d5aaa7a18b8 100644 --- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-embed-linked-doc.ts +++ b/blocksuite/affine/block-embed/src/embed-linked-doc-block/commands/insert-embed-linked-doc.ts @@ -3,6 +3,10 @@ import type { Command } from '@blocksuite/block-std'; import { insertEmbedCard } from '../../common/insert-embed-card.js'; +export type InsertedLinkType = { + flavour?: 'affine:bookmark' | 'affine:embed-linked-doc'; +} | null; + export const insertEmbedLinkedDocCommand: Command< never, 'insertedLinkType', diff --git a/blocksuite/affine/block-embed/src/embed-linked-doc-block/index.ts b/blocksuite/affine/block-embed/src/embed-linked-doc-block/index.ts index 3e908a6c00c65..5216305109bc7 100644 --- a/blocksuite/affine/block-embed/src/embed-linked-doc-block/index.ts +++ b/blocksuite/affine/block-embed/src/embed-linked-doc-block/index.ts @@ -1,4 +1,5 @@ -export * from './adapters/index.js'; -export * from './embed-linked-doc-block.js'; -export * from './embed-linked-doc-config.js'; -export * from './embed-linked-doc-spec.js'; +export * from './adapters'; +export type { InsertedLinkType } from './commands'; +export * from './embed-linked-doc-block'; +export * from './embed-linked-doc-config'; +export * from './embed-linked-doc-spec';