Merge pull request #34106 from nextcloud/backport/34100/stable24

[stable24] Reset global search on files sidebar navigation change
This commit is contained in:
Vincent Petry 2022-09-16 11:43:17 +02:00 committed by GitHub
commit cb0bfae73e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View file

@ -309,6 +309,7 @@
this._changeUrl(params.view, params.dir);
OC.Apps.hideAppSidebar($('.detailsView'));
this.navigation.getActiveContainer().trigger(new $.Event('urlChanged', params));
window._nc_event_bus.emit('files:navigation:changed')
}
},
@ -360,6 +361,7 @@
this.navigation.getActiveContainer().trigger(new $.Event('show'));
}
this.navigation.getActiveContainer().trigger(new $.Event('urlChanged', params));
window._nc_event_bus.emit('files:navigation:changed')
},
/**

View file

@ -123,7 +123,7 @@
</template>
<script>
import { emit } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { minSearchLength, getTypes, search, defaultLimit, regexFilterIn, regexFilterNot } from '../services/UnifiedSearchService'
import { showError } from '@nextcloud/dialogs'
@ -300,10 +300,15 @@ export default {
},
async created() {
subscribe('files:navigation:changed', this.resetForm)
this.types = await getTypes()
this.logger.debug('Unified Search initialized with the following providers', this.types)
},
beforeDestroy() {
unsubscribe('files:navigation:changed', this.resetForm)
},
mounted() {
document.addEventListener('keydown', (event) => {
// if not already opened, allows us to trigger default browser on second keydown
@ -338,6 +343,10 @@ export default {
emit('nextcloud:unified-search.close')
},
resetForm() {
this.$el.querySelector('form[role="search"]').reset()
},
/**
* Reset the search state
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long