mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-03 17:17:26 +00:00
- Rename `Project` => `Base` - Rename `Base` => `Source` - Remove `db` from data/meta api endpoints - Add backward compatibility for old apis - Migrations for renaming table and columns Signed-off-by: Pranav C <pranavxc@gmail.com>
63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import { acceptHMRUpdate, defineStore } from 'pinia'
|
|
import { isDrawerOrModalExist, useEventListener } from '#imports'
|
|
|
|
export const useProjectsShortcuts = defineStore('projectsShortcutsStore', () => {
|
|
const { $e } = useNuxtApp()
|
|
const { isUIAllowed } = useRoles()
|
|
|
|
const isMounted = ref(false)
|
|
|
|
const isFullScreen = ref(false)
|
|
|
|
const workspaceStore = useWorkspace()
|
|
|
|
workspaceStore.$subscribe(() => {
|
|
if (!isMounted.value) {
|
|
isMounted.value = true
|
|
}
|
|
})
|
|
|
|
watch(isMounted, () => {
|
|
useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
|
|
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
|
|
|
|
if (e.altKey && !e.shiftKey && !cmdOrCtrl) {
|
|
switch (e.keyCode) {
|
|
case 70: {
|
|
// ALT + F
|
|
if (!isDrawerOrModalExist()) {
|
|
$e('c:shortcut', { key: 'ALT + F' })
|
|
const sidebarStore = useSidebarStore()
|
|
|
|
isFullScreen.value = !isFullScreen.value
|
|
|
|
sidebarStore.isLeftSidebarOpen = !isFullScreen.value
|
|
sidebarStore.isRightSidebarOpen = !isFullScreen.value
|
|
}
|
|
break
|
|
}
|
|
// 'ALT + ,'
|
|
case 188: {
|
|
if (isUIAllowed('settingsPage') && !isDrawerOrModalExist()) {
|
|
$e('c:shortcut', { key: 'ALT + ,' })
|
|
const basesStore = useBases()
|
|
|
|
if (!basesStore.activeProjectId) return
|
|
|
|
basesStore.navigateToProject({
|
|
baseId: basesStore.activeProjectId,
|
|
page: 'collaborators',
|
|
})
|
|
}
|
|
break
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
})
|
|
|
|
if (import.meta.hot) {
|
|
import.meta.hot.accept(acceptHMRUpdate(useProjectsShortcuts as any, import.meta.hot))
|
|
}
|