fix: prevent emoji autocomplete

Add an empty entry to the emoji autocompletion which allows us to press enter to continue without any random emojis in the note where we did not intend them.

Fixes #5251

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2024-09-01 13:21:58 +02:00 committed by Yannick Bungers
parent 994b159618
commit 48ced674e7

View file

@ -28,14 +28,16 @@ export class EmojiAppExtension extends AppExtension {
} }
buildAutocompletion(): CompletionSource[] { buildAutocompletion(): CompletionSource[] {
return [ const completions = [
regexCompletion( {
/:(?:[\w-+]+:?)?/, detail: '',
emojiShortcodes.map((shortcode) => ({ label: ':'
detail: t('editor.autocompletions.emoji') ?? undefined, },
label: `:${shortcode}:` ...emojiShortcodes.map((shortcode) => ({
})) detail: t('editor.autocompletions.emoji') ?? undefined,
) label: `:${shortcode}:`
}))
] ]
return [regexCompletion(/:(?:[\w-+]+:?)?/, completions)]
} }
} }