Browse Source

refactor(nc-gui): use e.code instead & remove unused TableType

pull/5342/head
Wing-Kam Wong 2 years ago
parent
commit
02b5e75b72
  1. 9
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue

9
packages/nc-gui/pages/[projectType]/[projectId]/index.vue

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import tinycolor from 'tinycolor2' import tinycolor from 'tinycolor2'
import type { TableType } from 'nocodb-sdk'
import { import {
TabType, TabType,
computed, computed,
@ -224,8 +223,8 @@ function openKeyboardShortcutDialog() {
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
if (e.altKey && !e.shiftKey && !cmdOrCtrl) { if (e.altKey && !e.shiftKey && !cmdOrCtrl) {
switch (e.keyCode) { switch (e.code) {
case 188: { case 'Comma': {
// ALT + , // ALT + ,
if (isUIAllowed('settings') && !isDrawerOrModalExist()) { if (isUIAllowed('settings') && !isDrawerOrModalExist()) {
e.preventDefault() e.preventDefault()
@ -237,8 +236,8 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
} }
} }
if (cmdOrCtrl) { if (cmdOrCtrl) {
switch (e.key) { switch (e.code) {
case '/': case 'Slash':
if (!isDrawerOrModalExist()) { if (!isDrawerOrModalExist()) {
$e('c:shortcut', { key: 'CTRL + /' }) $e('c:shortcut', { key: 'CTRL + /' })
openKeyboardShortcutDialog() openKeyboardShortcutDialog()

Loading…
Cancel
Save