mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-02 02:18:33 +00:00
fix(nc-gui): use useSelectedCellKeyupListener instead useEventListener in date time related cell
This commit is contained in:
@@ -275,30 +275,34 @@ const handleKeydown = (e: KeyboardEvent, _open?: boolean) => {
|
||||
}
|
||||
}
|
||||
|
||||
useEventListener(document, 'keydown', (e: KeyboardEvent) => {
|
||||
// To prevent event listener on non active cell
|
||||
if (!active.value) return
|
||||
useSelectedCellKeyupListener(
|
||||
active,
|
||||
(e) => {
|
||||
if (e.altKey || e.shiftKey) {
|
||||
return
|
||||
}
|
||||
|
||||
if (e.altKey || e.shiftKey || !isGrid.value || isExpandedForm.value || isEditColumn.value || isExpandedFormOpenExist()) {
|
||||
return
|
||||
}
|
||||
if (e.metaKey || e.ctrlKey) {
|
||||
if (e.key === ';') {
|
||||
if (isGrid.value && !isExpandedForm.value && !isEditColumn.value) {
|
||||
localState.value = dayjs(new Date())
|
||||
e.preventDefault()
|
||||
}
|
||||
} else return
|
||||
}
|
||||
|
||||
if (e.metaKey || e.ctrlKey) {
|
||||
if (e.key === ';') {
|
||||
if (isGrid.value && !isExpandedForm.value && !isEditColumn.value) {
|
||||
localState.value = dayjs(new Date())
|
||||
e.preventDefault()
|
||||
}
|
||||
} else return
|
||||
}
|
||||
|
||||
if (!isOpen.value && datePickerRef.value && /^[0-9a-z]$/i.test(e.key)) {
|
||||
isClearedInputMode.value = true
|
||||
datePickerRef.value.focus()
|
||||
editable.value = true
|
||||
open.value = true
|
||||
}
|
||||
})
|
||||
if (!isOpen.value && datePickerRef.value && /^[0-9a-z]$/i.test(e.key)) {
|
||||
isClearedInputMode.value = true
|
||||
datePickerRef.value.focus()
|
||||
editable.value = true
|
||||
open.value = true
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
isGridCell: isGrid.value,
|
||||
},
|
||||
)
|
||||
|
||||
function handleSelectDate(value?: dayjs.Dayjs) {
|
||||
tempDate.value = value
|
||||
|
||||
Reference in New Issue
Block a user