diff --git a/packages/text-editor/src/components/extensions.ts b/packages/text-editor/src/components/extensions.ts index 662b93e9f1..260cf11f3c 100644 --- a/packages/text-editor/src/components/extensions.ts +++ b/packages/text-editor/src/components/extensions.ts @@ -22,6 +22,7 @@ import MentionList from './MentionList.svelte' import { NodeUuidExtension } from './extension/nodeUuid' import { SvelteRenderer } from './node-view' import { CodemarkExtension } from './extension/codemark' +import type { SuggestionKeyDownProps, SuggestionProps } from './extension/suggestion' export const tableExtensions = [ Table.configure({ @@ -157,14 +158,14 @@ export const completionConfig: Partial = { class: 'reference' }, suggestion: { - items: async (query: { query: string }) => { + items: async () => { return [] }, render: () => { let component: any return { - onStart: (props: any) => { + onStart: (props: SuggestionProps) => { component = new SvelteRenderer(MentionList, { element: document.body, props: { @@ -175,10 +176,13 @@ export const completionConfig: Partial = { } }) }, - onUpdate (props: any) { + onUpdate (props: SuggestionProps) { component.updateProps(props) }, - onKeyDown (props: any) { + onKeyDown (props: SuggestionKeyDownProps) { + if (props.event.key === 'Escape') { + props.event.stopPropagation() + } return component.onKeyDown(props) }, onExit () {