Browse Source

fix(nc-gui): alt+c binding

pull/6861/head
DarkPhoenix2704 1 year ago
parent
commit
f89dee1fef
  1. 21
      packages/nc-gui/components/smartsheet/details/Fields.vue

21
packages/nc-gui/components/smartsheet/details/Fields.vue

@ -582,6 +582,8 @@ const toggleVisibility = async (checked: boolean, field: Field) => {
useEventListener(document, 'keydown', async (e: KeyboardEvent) => { useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
const altOrOptionKey = e.altKey
if (cmdOrCtrl) { if (cmdOrCtrl) {
switch (e.key.toLowerCase()) { switch (e.key.toLowerCase()) {
case 's': case 's':
@ -590,6 +592,15 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
break break
} }
} }
if (altOrOptionKey) {
switch (e.key.toLowerCase()) {
case 'c':
if (openedViewsTab.value !== 'field') return
e.preventDefault()
addField()
break
}
}
}) })
onKeyDown('ArrowDown', () => { onKeyDown('ArrowDown', () => {
@ -633,16 +644,6 @@ onKeyDown('ArrowRight', () => {
const keys = useMagicKeys() const keys = useMagicKeys()
whenever(keys.altleft_c, () => {
if (!meta.value?.id) return
if (openedViewsTab.value === 'field') addField()
})
whenever(keys.option_c, () => {
if (!meta.value?.id) return
if (openedViewsTab.value === 'field') addField()
})
whenever(keys.meta_s, () => { whenever(keys.meta_s, () => {
if (!meta.value?.id) return if (!meta.value?.id) return
if (openedViewsTab.value === 'field') saveChanges() if (openedViewsTab.value === 'field') saveChanges()

Loading…
Cancel
Save