mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-05 00:06:40 +00:00
feat: add today shortcut for Date related fields (#9425)
* fix: document today's date shortcut * fix: update keyboard bindings * fix: update keybinding * fix: date time cell copypaste
This commit is contained in:
@@ -296,31 +296,24 @@ useEventListener(document, 'keydown', (e: KeyboardEvent) => {
|
||||
// To prevent event listener on non active cell
|
||||
if (!active.value) return
|
||||
|
||||
if (
|
||||
e.altKey ||
|
||||
e.ctrlKey ||
|
||||
e.shiftKey ||
|
||||
e.metaKey ||
|
||||
!isGrid.value ||
|
||||
isExpandedForm.value ||
|
||||
isEditColumn.value ||
|
||||
isExpandedFormOpenExist()
|
||||
) {
|
||||
if (e.altKey || e.shiftKey || !isGrid.value || isExpandedForm.value || isEditColumn.value || isExpandedFormOpenExist()) {
|
||||
return
|
||||
}
|
||||
|
||||
switch (e.key) {
|
||||
case ';':
|
||||
localState.value = dayjs(new Date())
|
||||
e.preventDefault()
|
||||
break
|
||||
default:
|
||||
if (!isOpen.value && (datePickerRef.value || timePickerRef.value) && /^[0-9a-z]$/i.test(e.key)) {
|
||||
isClearedInputMode.value = true
|
||||
isDatePicker.value ? datePickerRef.value?.focus() : timePickerRef.value?.focus()
|
||||
editable.value = true
|
||||
open.value = true
|
||||
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 || timePickerRef.value) && /^[0-9a-z]$/i.test(e.key)) {
|
||||
isClearedInputMode.value = true
|
||||
isDatePicker.value ? datePickerRef.value?.focus() : timePickerRef.value?.focus()
|
||||
editable.value = true
|
||||
open.value = true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user