Browse Source

fix: block default action on shortcut key press and typo correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4222/head
Pranav C 2 years ago
parent
commit
72d10d415e
  1. 8
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 5
      packages/nc-gui/components/virtual-cell/components/ListItems.vue

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

@ -177,11 +177,15 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange
const activePickerOrDropdownEl = document.querySelector(
'.nc-picker-datetime.active,.nc-dropdown-single-select-cell.active,.nc-dropdown-multi-select-cell.active,.nc-picker-date.active,.nc-picker-year.active,.nc-picker-time.active',
)
if (activePickerOrDropdownEl) return true
if (activePickerOrDropdownEl) {
e.preventDefault()
return true
}
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
if (e.key === 'Space') {
if (e.code === 'Space') {
if (selected.row !== null && !editEnabled) {
e.preventDefault()
const row = data.value[selected.row]
expandForm(row)
return true

5
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -108,10 +108,12 @@ useSelectedCellKeyupListener(vModel, (e: KeyboardEvent) => {
switch (e.key) {
case 'ArrowLeft':
e.stopPropagation()
e.preventDefault()
if (childrenExcludedListPagination.page > 1) childrenExcludedListPagination.page--
break
case 'ArrowRight':
e.stopPropagation()
e.preventDefault()
if (
childrenExcludedList.value?.pageInfo &&
childrenExcludedListPagination.page <
@ -122,10 +124,12 @@ useSelectedCellKeyupListener(vModel, (e: KeyboardEvent) => {
case 'ArrowUp':
selectedRowIndex.value = Math.max(0, selectedRowIndex.value - 1)
e.stopPropagation()
e.preventDefault()
break
case 'ArrowDown':
selectedRowIndex.value = Math.min(childrenExcludedList.value?.list?.length - 1, selectedRowIndex.value + 1)
e.stopPropagation()
e.preventDefault()
break
case 'Enter':
{
@ -133,6 +137,7 @@ useSelectedCellKeyupListener(vModel, (e: KeyboardEvent) => {
if (selectedRow) {
linkRow(selectedRow)
e.stopPropagation()
e.preventDefault()
}
}
break

Loading…
Cancel
Save