슬래시 미일치 Enter 동작 보정

This commit is contained in:
2026-07-28 10:00:01 +09:00
parent a0e126b2a9
commit 5e4ccbf2bf
10 changed files with 138 additions and 32 deletions

View File

@@ -55,6 +55,7 @@ import {
insertMarkdownLinesAtSlashTarget,
parseSlashInput,
resolveSlashCommand,
shouldCaptureSlashMenuKeyboardAction,
shouldIgnorePendingMediaSlashCommit
} from '../../lib/markdown-slash-commands.js'
import {
@@ -1276,37 +1277,49 @@ onMounted(() => {
if (liveSlashVisible.value) {
const slashKeyboardAction = getSlashMenuKeyboardAction(event.key)
const slashCommandCount = visibleLiveSlashCommands.value.length
if (slashKeyboardAction === 'navigate') {
event.preventDefault()
const count = visibleLiveSlashCommands.value.length
if (count) {
startLiveSlashKeyboardNavigation()
liveSlashHighlightedIndex.value = getNextSlashHighlightedIndex({
currentIndex: liveSlashHighlightedIndex.value,
commandCount: count,
key: event.key
})
if (!shouldCaptureSlashMenuKeyboardAction({
action: slashKeyboardAction,
commandCount: slashCommandCount
})) {
return
}
event.preventDefault()
event.stopPropagation()
startLiveSlashKeyboardNavigation()
liveSlashHighlightedIndex.value = getNextSlashHighlightedIndex({
currentIndex: liveSlashHighlightedIndex.value,
commandCount: slashCommandCount,
key: event.key
})
return
}
if (slashKeyboardAction === 'apply') {
event.preventDefault()
const command = visibleLiveSlashCommands.value[liveSlashHighlightedIndex.value]
if (command) {
applyLiveSlashCommand(command)
if (!shouldCaptureSlashMenuKeyboardAction({
action: slashKeyboardAction,
commandCount: slashCommandCount
}) || !command) {
clearLiveSlashState()
return
}
event.preventDefault()
event.stopPropagation()
applyLiveSlashCommand(command)
return
}
if (slashKeyboardAction === 'cancel') {
event.preventDefault()
event.stopPropagation()
cancelLiveSlashCommand()
return
}
@@ -2517,6 +2530,7 @@ const onLiveSlashApply = (payload) => {
const command = resolveSlashCommand(parsed?.query ?? liveSlashQuery.value)
if (!command) {
onLiveSlashEnd({ sourceLine: payload?.sourceLine })
return
}