mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(unified-search): Close on second ctrl+f
Also only add the event listener if short-cuts are not disabled for accessibility reasons. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
74cd6e295a
commit
d7376891a2
1 changed files with 7 additions and 4 deletions
|
|
@ -97,7 +97,9 @@ export default defineComponent({
|
|||
|
||||
mounted() {
|
||||
// register keyboard listener for search shortcut
|
||||
window.addEventListener('keydown', this.onKeyDown)
|
||||
if (window.OCP.Accessibility.disableKeyboardShortcuts() === false) {
|
||||
window.addEventListener('keydown', this.onKeyDown)
|
||||
}
|
||||
|
||||
// Allow external reset of the search / close local search
|
||||
subscribe('nextcloud:unified-search:reset', () => {
|
||||
|
|
@ -131,9 +133,9 @@ export default defineComponent({
|
|||
if (event.ctrlKey && event.code === 'KeyF') {
|
||||
// only handle search if not already open - in this case the browser native search should be used
|
||||
if (!this.showLocalSearch && !this.showUnifiedSearch) {
|
||||
this.toggleUnifiedSearch()
|
||||
event.preventDefault()
|
||||
}
|
||||
this.toggleUnifiedSearch()
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -142,9 +144,10 @@ export default defineComponent({
|
|||
*/
|
||||
toggleUnifiedSearch() {
|
||||
if (this.supportsLocalSearch) {
|
||||
this.showLocalSearch = true
|
||||
this.showLocalSearch = !this.showLocalSearch
|
||||
} else {
|
||||
this.openModal()
|
||||
this.showUnifiedSearch = !this.showUnifiedSearch
|
||||
this.showLocalSearch = false
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue