diff --git a/blocksuite/affine/blocks/note/src/configs/slash-menu.ts b/blocksuite/affine/blocks/note/src/configs/slash-menu.ts index 3c41811cbe..8efc0b2998 100644 --- a/blocksuite/affine/blocks/note/src/configs/slash-menu.ts +++ b/blocksuite/affine/blocks/note/src/configs/slash-menu.ts @@ -82,12 +82,13 @@ function createConversionItem( config: TextConversionConfig, group?: SlashMenuItem['group'] ): SlashMenuActionItem { - const { name, description, icon, flavour, type } = config; + const { name, description, icon, flavour, type, searchAlias = [] } = config; return { name, group, description, icon, + searchAlias, tooltip: tooltips[name], when: ({ model }) => model.store.schema.flavourSchemaMap.has(flavour), action: ({ std }) => { diff --git a/blocksuite/affine/rich-text/src/conversion.ts b/blocksuite/affine/rich-text/src/conversion.ts index 61612c8b5e..a48250bea8 100644 --- a/blocksuite/affine/rich-text/src/conversion.ts +++ b/blocksuite/affine/rich-text/src/conversion.ts @@ -26,6 +26,7 @@ export interface TextConversionConfig { description?: string; hotkey: string[] | null; icon: TemplateResult<1>; + searchAlias?: string[]; } export const textConversionConfigs: TextConversionConfig[] = [ @@ -106,6 +107,7 @@ export const textConversionConfigs: TextConversionConfig[] = [ type: 'todo', name: 'To-do List', description: 'Add tasks to a to-do list.', + searchAlias: ['checkbox'], hotkey: null, icon: CheckBoxIcon, }, diff --git a/tests/blocksuite/e2e/slash-menu.spec.ts b/tests/blocksuite/e2e/slash-menu.spec.ts index e7c38748af..b23f7f1322 100644 --- a/tests/blocksuite/e2e/slash-menu.spec.ts +++ b/tests/blocksuite/e2e/slash-menu.spec.ts @@ -577,7 +577,7 @@ test.describe('slash search', () => { // search should active the first item await type(page, 'co'); - await expect(slashItems).toHaveCount(4); + await expect(slashItems).toHaveCount(5); await expect(slashItems.nth(0).locator('.text')).toHaveText(['Copy']); await expect(slashItems.nth(1).locator('.text')).toHaveText(['Code Block']); await expect(slashItems.nth(2).locator('.text')).toHaveText(['Callout']); @@ -589,7 +589,7 @@ test.describe('slash search', () => { // assert backspace works await pressBackspace(page); - await expect(slashItems).toHaveCount(4); + await expect(slashItems).toHaveCount(5); await expect(slashItems.nth(0).locator('.text')).toHaveText(['Copy']); await expect(slashItems.nth(1).locator('.text')).toHaveText(['Code Block']); await expect(slashItems.nth(2).locator('.text')).toHaveText(['Callout']); @@ -608,7 +608,7 @@ test.describe('slash search', () => { await expect(slashMenu).toBeVisible(); await type(page, 'c'); - await expect(slashItems).toHaveCount(10); + await expect(slashItems).toHaveCount(11); await expect(slashItems.nth(0).locator('.text')).toHaveText(['Copy']); await expect(slashItems.nth(1).locator('.text')).toHaveText(['Italic']); await expect(slashItems.nth(2).locator('.text')).toHaveText(['Callout']);