Skip to content

Commit c36e9ec

Browse files
committed
feat(settings): advertise keyboard shortcuts in user management
-e Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
1 parent 27e9172 commit c36e9ec

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

apps/settings/src/components/Users/UserSettingsDialog.vue

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,30 @@
103103
taggable
104104
@option:selected="setDefaultQuota" />
105105
</NcAppSettingsSection>
106+
107+
<NcAppSettingsShortcutsSection>
108+
<NcHotkeyList :label="t('settings', 'Search')">
109+
<NcHotkey :label="t('settings', 'Focus search')" hotkey="Control F" />
110+
</NcHotkeyList>
111+
<NcHotkeyList :label="t('settings', 'Help')">
112+
<NcHotkey :label="t('settings', 'Show those shortcuts')" hotkey="?" />
113+
</NcHotkeyList>
114+
</NcAppSettingsShortcutsSection>
106115
</NcAppSettingsDialog>
107116
</template>
108117

109118
<script>
110119
import axios from '@nextcloud/axios'
111120
import { formatFileSize, parseFileSize } from '@nextcloud/files'
112121
import { generateUrl } from '@nextcloud/router'
122+
import { useHotKey } from '@nextcloud/vue/composables/useHotKey'
123+
import { nextTick } from 'vue'
113124
import NcAppSettingsDialog from '@nextcloud/vue/components/NcAppSettingsDialog'
114125
import NcAppSettingsSection from '@nextcloud/vue/components/NcAppSettingsSection'
126+
import NcAppSettingsShortcutsSection from '@nextcloud/vue/components/NcAppSettingsShortcutsSection'
115127
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
128+
import NcHotkey from '@nextcloud/vue/components/NcHotkey'
129+
import NcHotkeyList from '@nextcloud/vue/components/NcHotkeyList'
116130
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
117131
import NcSelect from '@nextcloud/vue/components/NcSelect'
118132
import { GroupSorting } from '../../constants/GroupManagement.ts'
@@ -125,7 +139,10 @@ export default {
125139
components: {
126140
NcAppSettingsDialog,
127141
NcAppSettingsSection,
142+
NcAppSettingsShortcutsSection,
128143
NcCheckboxRadioSwitch,
144+
NcHotkey,
145+
NcHotkeyList,
129146
NcNoteCard,
130147
NcSelect,
131148
},
@@ -137,6 +154,20 @@ export default {
137154
},
138155
},
139156
157+
emits: ['update:open'],
158+
159+
setup(_, { emit }) {
160+
// ? opens the settings dialog on the keyboard shortcuts section
161+
useHotKey('?', async () => {
162+
emit('update:open', true)
163+
await nextTick()
164+
document.getElementById('settings-section_keyboard-shortcuts')?.scrollIntoView({
165+
behavior: 'smooth',
166+
inline: 'nearest',
167+
})
168+
}, { stop: true, prevent: true })
169+
},
170+
140171
data() {
141172
return {
142173
selectedQuota: false,

0 commit comments

Comments
 (0)