Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
This commit is contained in:
parent
97f276cea8
commit
7ffec887f7
|
|
@ -232,7 +232,16 @@ export function createRichMarkdownKeyHandler(
|
|||
return false
|
||||
}
|
||||
|
||||
const currentFilteredSlashCommands = ctx.filteredSlashCommandsRef.current
|
||||
|
||||
if (!event.metaKey && !event.ctrlKey && !event.altKey && event.key.length === 1) {
|
||||
// Why: when the current query has no matching commands the slash menu UI
|
||||
// is already hidden; intercepting further keystrokes would silently
|
||||
// swallow them. Fall through so ProseMirror inserts the character and
|
||||
// syncSlashMenu refreshes the query from the document.
|
||||
if (currentFilteredSlashCommands.length === 0) {
|
||||
return false
|
||||
}
|
||||
event.preventDefault()
|
||||
ctx.setSlashMenu((menu) => (menu ? { ...menu, query: `${menu.query}${event.key}` } : menu))
|
||||
ctx.setSelectedCommandIndex(0)
|
||||
|
|
@ -246,7 +255,6 @@ export function createRichMarkdownKeyHandler(
|
|||
return true
|
||||
}
|
||||
|
||||
const currentFilteredSlashCommands = ctx.filteredSlashCommandsRef.current
|
||||
if (currentFilteredSlashCommands.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue