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

@@ -219,6 +219,21 @@ export const resolveSlashCommand = (query) => {
return exact ?? matches[0]
}
/**
* 편집 값에서 적용 가능한 슬래시 명령을 해석한다.
* @param {string} value - 편집 값
* @returns {MarkdownSlashCommand|null} 명령
*/
export const resolveSlashCommandFromInputValue = (value) => {
const parsed = parseSlashInput(value)
if (!parsed) {
return null
}
return resolveSlashCommand(parsed.query)
}
/**
* 미디어 선택 모달을 여는 슬래시 명령인지 확인한다.
* @param {string} action - 명령 action
@@ -379,6 +394,27 @@ export const getSlashMenuKeyboardAction = (key) => {
return ''
}
/**
* 슬래시 메뉴가 키보드 이벤트를 직접 가로채야 하는지 확인한다.
* @param {Object} options - 판별 옵션
* @param {'navigate'|'apply'|'cancel'|''} options.action - 키보드 동작
* @param {number} options.commandCount - 현재 표시된 명령 개수
* @returns {boolean} 가로채기 여부
*/
export const shouldCaptureSlashMenuKeyboardAction = ({ action, commandCount }) => {
if (action === 'cancel') {
return true
}
const count = Number.isFinite(commandCount) ? Math.max(0, Math.floor(commandCount)) : 0
if (action === 'navigate' || action === 'apply') {
return count > 0
}
return false
}
/**
* 라이브 모드 미디어 슬래시 명령 처리 중 지연 commit을 무시할지 확인한다.
* @param {Object} options - 판별 옵션