diff --git a/apps/files/src/views/Navigation.vue b/apps/files/src/views/Navigation.vue index 1420e8e1d9e0f..4fa4f72fe3c24 100644 --- a/apps/files/src/views/Navigation.vue +++ b/apps/files/src/views/Navigation.vue @@ -16,7 +16,7 @@ - diff --git a/apps/files/src/views/Settings.vue b/apps/files/src/views/Settings.vue index c64f3b898b2f8..2cd01e787ff88 100644 --- a/apps/files/src/views/Settings.vue +++ b/apps/files/src/views/Settings.vue @@ -82,6 +82,123 @@ + + + {{ t('files', 'Speed up yur Files experience with these quick shortcuts.') }} + +

{{ t('files', 'Actions') }}

+
+
+
A
+
+ {{ t('files', 'Open the actions menu for a file') }} +
+
+
+
F2
+
+ {{ t('files', 'Rename a file') }} +
+
+
+
Del
+
+ {{ t('files', 'Delete a file') }} +
+
+
+
S
+
+ {{ t('files', 'Favorite or remove a file from favorites') }} +
+
+
+ +

{{ t('files', 'Selection') }}

+
+
+
Ctrl + A
+
+ {{ t('files', 'Select all files') }} +
+
+
+
ESC
+
+ {{ t('files', 'Deselect all files') }} +
+
+
+
Ctrl + Space
+
+ {{ t('files', 'Select or deselect a file') }} +
+
+
+
Ctrl + Shift + Space
+
+ {{ t('files', 'Select a range of files') }} +
+
+
+ +

{{ t('files', 'Navigation') }}

+
+
+
+
+ {{ t('files', 'Navigate to the file above') }} +
+
+
+
Alt +
+
+ {{ t('files', 'Navigate to the parent folder') }} +
+
+
+
+
+ {{ t('files', 'Navigate to the file below') }} +
+
+
+
+
+ {{ t('files', 'Navigate to the file on the left (in grid mode)') }} +
+
+
+
+
+ {{ t('files', 'Navigate to the file on the right (in grid mode)') }} +
+
+
+ +

{{ t('files', 'View') }}

+
+
+
V
+
+ {{ t('files', 'Toggle the grid view') }} +
+
+
+
D
+
+ {{ t('files', 'Open the sidebar for a file') }} +
+
+
+
?
+
+ {{ t('files', 'Show those shortcuts') }} +
+
+
+
@@ -99,6 +216,7 @@ import { showError, showSuccess } from '@nextcloud/dialogs' import { translate } from '@nextcloud/l10n' import { loadState } from '@nextcloud/initial-state' import { useUserConfigStore } from '../store/userconfig.ts' +import { isDialogOpened } from '../utils/dialogUtils.ts' export default { name: 'Settings', @@ -148,11 +266,13 @@ export default { beforeMount() { // Update the settings API entries state this.settings.forEach(setting => setting.open()) + document.addEventListener('keydown', this.onKeyDown) }, beforeDestroy() { // Update the settings API entries state this.settings.forEach(setting => setting.close()) + document.removeEventListener('keydown', this.onKeyDown) }, methods: { @@ -181,6 +301,25 @@ export default { }, 5000) }, + async onKeyDown(event) { + if (isDialogOpened()) { + return + } + + // ? opens the settings dialog on the keyboard shortcuts section + if (event.key === '?') { + event.preventDefault() + event.stopPropagation() + this.$emit('update:open', true) + + await this.$nextTick() + document.getElementById('settings-section_shortcuts').scrollIntoView({ + behavior: 'smooth', + inline: 'nearest', + }) + } + }, + t: translate, }, } @@ -190,4 +329,14 @@ export default { .setting-link:hover { text-decoration: underline; } + +dt { + width: 160px; + // some shortcuts are too long to fit in one line + white-space: normal; + span { + // force portion of a shortcut on a new line for nicer display + white-space: nowrap; + } +}