Fix '%' mentioning if you escape out

This commit is contained in:
Austin Chen 2022-09-15 17:12:49 -07:00
parent e1350c084d
commit 1b7fd31b88

View File

@ -61,10 +61,16 @@ export const contractMentionSuggestion: Suggestion = {
}) })
}, },
onKeyDown(props) { onKeyDown(props) {
if (props.event.key === 'Escape') { if (props.event.key)
popup?.[0].hide() if (
return true props.event.key === 'Escape' ||
} // Also break out of the mention if the tooltip isn't visible
(props.event.key === 'Enter' && !popup?.[0].state.isShown)
) {
popup?.[0].destroy()
component?.destroy()
return false
}
return (component?.ref as any)?.onKeyDown(props) return (component?.ref as any)?.onKeyDown(props)
}, },
onExit() { onExit() {