슬래시 메뉴 키 입력 판별 분리
This commit is contained in:
@@ -319,6 +319,27 @@ export const getNextSlashHighlightedIndex = ({ currentIndex, commandCount, key }
|
||||
return index
|
||||
}
|
||||
|
||||
/**
|
||||
* 슬래시 메뉴에서 키보드 입력이 수행할 동작을 계산한다.
|
||||
* @param {string} key - 누른 키
|
||||
* @returns {'navigate'|'apply'|'cancel'|''} 메뉴 동작
|
||||
*/
|
||||
export const getSlashMenuKeyboardAction = (key) => {
|
||||
if (key === 'ArrowDown' || key === 'ArrowUp') {
|
||||
return 'navigate'
|
||||
}
|
||||
|
||||
if (key === 'Enter') {
|
||||
return 'apply'
|
||||
}
|
||||
|
||||
if (key === 'Escape') {
|
||||
return 'cancel'
|
||||
}
|
||||
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 라이브 모드 미디어 슬래시 명령 처리 중 지연 commit을 무시할지 확인한다.
|
||||
* @param {Object} options - 판별 옵션
|
||||
|
||||
Reference in New Issue
Block a user