Browse Source

fix(nc-gui): prevent default on arrow keys only

pull/4482/head
Wing-Kam Wong 2 years ago
parent
commit
4820c09f65
  1. 5
      packages/nc-gui/components/smartsheet/Grid.vue

5
packages/nc-gui/components/smartsheet/Grid.vue

@ -210,27 +210,30 @@ const { selectCell, startSelectRange, endSelectRange, clearSelectedRange, copyVa
} }
if (cmdOrCtrl) { if (cmdOrCtrl) {
e.preventDefault()
switch (e.key) { switch (e.key) {
case 'ArrowUp': case 'ArrowUp':
e.preventDefault()
selectedCell.row = 0 selectedCell.row = 0
selectedCell.col = selectedCell.col ?? 0 selectedCell.col = selectedCell.col ?? 0
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowDown': case 'ArrowDown':
e.preventDefault()
selectedCell.row = data.value.length - 1 selectedCell.row = data.value.length - 1
selectedCell.col = selectedCell.col ?? 0 selectedCell.col = selectedCell.col ?? 0
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowRight': case 'ArrowRight':
e.preventDefault()
selectedCell.row = selectedCell.row ?? 0 selectedCell.row = selectedCell.row ?? 0
selectedCell.col = fields.value?.length - 1 selectedCell.col = fields.value?.length - 1
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowLeft': case 'ArrowLeft':
e.preventDefault()
selectedCell.row = selectedCell.row ?? 0 selectedCell.row = selectedCell.row ?? 0
selectedCell.col = 0 selectedCell.col = 0
scrollToCell?.() scrollToCell?.()

Loading…
Cancel
Save