Browse Source

fix: on escape key press toggle to readonly

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4222/head
Pranav C 2 years ago
parent
commit
1fa5e3c251
  1. 12
      packages/nc-gui/components/smartsheet/Grid.vue

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

@ -156,13 +156,12 @@ const getContainerScrollForElement = (
relativePos.bottom + (offset?.bottom || 0) > 0
? container.scrollTop + relativePos.bottom + (offset?.bottom || 0)
: relativePos.top - (offset?.top || 0) < 0
? container.scrollTop + relativePos.top - (offset?.top || 0)
: container.scrollTop
? container.scrollTop + relativePos.top - (offset?.top || 0)
: container.scrollTop
return scroll
}
const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange, selected } = useMultiSelect(
fields,
data,
@ -183,13 +182,18 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange
}
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
if (e.code === 'Space') {
if (e.key === ' ') {
if (selected.row !== null && !editEnabled) {
e.preventDefault()
const row = data.value[selected.row]
expandForm(row)
return true
}
} else if (e.key === 'Escape') {
if (editEnabled) {
editEnabled = false
return true
}
}
if (cmdOrCtrl) {
switch (e.key) {

Loading…
Cancel
Save