refactor(shortcuts): use event.code for raw keyboard handlers
Change e.key to e.code in global keyboard shortcut handlers for consistency with the new event.code-based shortcut system: - ProjectList.vue: 'j'/'k'/'Enter' -> 'KeyJ'/'KeyK'/'Enter' - useGanttBar.ts: 'ArrowLeft'/'ArrowRight' (identical values, for consistency) - Modal.vue: 'Escape' (identical value, for consistency)
This commit is contained in:
parent
e3fdaed94a
commit
79cd3433f5
|
|
@ -101,7 +101,7 @@ watchEffect(() => {
|
|||
})
|
||||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') {
|
||||
if (e.code === 'Escape') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,13 +322,13 @@ function handleListNavigation(e: KeyboardEvent) {
|
|||
return
|
||||
}
|
||||
|
||||
if (e.key === 'j') {
|
||||
if (e.code === 'KeyJ') {
|
||||
e.preventDefault()
|
||||
focusTask(Math.min(focusedIndex.value + 1, tasks.value.length - 1))
|
||||
return
|
||||
}
|
||||
|
||||
if (e.key === 'k') {
|
||||
if (e.code === 'KeyK') {
|
||||
e.preventDefault()
|
||||
if (focusedIndex.value === -1) {
|
||||
focusTask(tasks.value.length - 1)
|
||||
|
|
@ -345,7 +345,7 @@ function handleListNavigation(e: KeyboardEvent) {
|
|||
return
|
||||
}
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
if (e.code === 'Enter') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,31 +64,31 @@ export function useGanttBar(options: UseGanttBarOptions) {
|
|||
function onKeyDown(e: KeyboardEvent) {
|
||||
// task expanding
|
||||
if (e.shiftKey) {
|
||||
if (e.key === 'ArrowLeft') {
|
||||
if (e.code === 'ArrowLeft') {
|
||||
e.preventDefault()
|
||||
changeSize('left', 1)
|
||||
}
|
||||
if (e.key === 'ArrowRight') {
|
||||
if (e.code === 'ArrowRight') {
|
||||
e.preventDefault()
|
||||
changeSize('right', 1)
|
||||
}
|
||||
}
|
||||
// task shrinking
|
||||
else if (e.ctrlKey) {
|
||||
if (e.key === 'ArrowLeft') {
|
||||
if (e.code === 'ArrowLeft') {
|
||||
e.preventDefault()
|
||||
changeSize('left', -1)
|
||||
}
|
||||
if (e.key === 'ArrowRight') {
|
||||
if (e.code === 'ArrowRight') {
|
||||
e.preventDefault()
|
||||
changeSize('right', -1)
|
||||
}
|
||||
}
|
||||
// task movement
|
||||
else if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
||||
else if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {
|
||||
e.preventDefault()
|
||||
|
||||
const dir = e.key === 'ArrowRight' ? 1 : -1
|
||||
const dir = e.code === 'ArrowRight' ? 1 : -1
|
||||
const newStart = new Date(options.model.start)
|
||||
newStart.setDate(newStart.getDate() + dir)
|
||||
const newEnd = new Date(options.model.end)
|
||||
|
|
|
|||
Loading…
Reference in New Issue