슬래시 미일치 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

@@ -13,7 +13,10 @@ import {
LIVE_SELECTION_BRIDGE_KEY,
selectEditableElementContents
} from '../../lib/markdown-live-selection.js'
import { parseSlashInput } from '../../lib/markdown-slash-commands.js'
import {
parseSlashInput,
resolveSlashCommandFromInputValue
} from '../../lib/markdown-slash-commands.js'
const props = defineProps({
/** 인라인 마크다운 원문 */
@@ -1340,7 +1343,7 @@ const onKeydown = (event) => {
}
}
if (props.slashMenuActive) {
if (props.slashMenuActive && event.key !== 'Enter') {
return
}
@@ -1388,15 +1391,26 @@ const onKeydown = (event) => {
const isComposingEnter = event.key === 'Enter'
&& (event.isComposing || event.keyCode === 229 || isComposingText.value)
if (event.key === 'Enter' && !event.shiftKey && !isComposingEnter && parseSlashInput(readEditorValue())) {
event.preventDefault()
event.stopPropagation()
event.stopImmediatePropagation?.()
emit('slash-apply', {
sourceLine: props.sourceLine,
value: readEditorValue()
})
return
if (event.key === 'Enter' && !event.shiftKey && !isComposingEnter) {
const editorValue = readEditorValue()
const parsedSlashInput = parseSlashInput(editorValue)
if (parsedSlashInput) {
const command = resolveSlashCommandFromInputValue(editorValue)
if (command) {
event.preventDefault()
event.stopPropagation()
event.stopImmediatePropagation?.()
emit('slash-apply', {
sourceLine: props.sourceLine,
value: editorValue
})
return
}
emit('slash-end', { sourceLine: props.sourceLine })
}
}
if (event.key === 'Enter' && enterAction) {