File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929 "dependencies" : {
3030 "@nextcloud/axios" : " ^1.3.3" ,
3131 "@nextcloud/dialogs" : " ^2.0.1" ,
32+ "@nextcloud/event-bus" : " ^1.2.0" ,
3233 "@nextcloud/initial-state" : " 1.1.2" ,
3334 "@nextcloud/moment" : " ^1.1.1" ,
3435 "@nextcloud/router" : " ^1.1.0" ,
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ import VTooltip from 'v-tooltip'
3131import VueClipboard from 'vue-clipboard2'
3232import { linkTo } from '@nextcloud/router'
3333
34+ import { subscribe , unsubscribe } from '@nextcloud/event-bus'
35+
3436// Disable on production
3537Vue . config . devtools = true
3638Vue . config . performance = true
@@ -83,13 +85,28 @@ OCA.Tasks.App = new Vue({
8385 }
8486 } ,
8587 mounted ( ) {
86- this . $OC . Search = new OCA . Search ( this . filter , this . cleanSearch )
88+ const version = this . $OC . config . version . split ( '.' )
89+
90+ if ( version [ 0 ] >= 20 ) {
91+ // Hook to new global event for unified search
92+ subscribe ( 'nextcloud:unified-search:search' , this . filterProxy )
93+ subscribe ( 'nextcloud:unified-search:close' , this . cleanSearch )
94+ } else {
95+ this . $OC . Search = new OCA . Search ( this . filter , this . cleanSearch )
96+ }
8797 } ,
8898 beforeMount ( ) {
8999 this . $store . dispatch ( 'loadCollections' )
90100 this . $store . dispatch ( 'loadSettings' )
91101 } ,
102+ beforeDestroy ( ) {
103+ unsubscribe ( 'nextcloud:unified-search:search' , this . filterProxy )
104+ unsubscribe ( 'nextcloud:unified-search:close' , this . cleanSearch )
105+ } ,
92106 methods : {
107+ filterProxy ( { query } ) {
108+ this . filter ( query )
109+ } ,
93110 filter ( query ) {
94111 this . $store . commit ( 'setSearchQuery' , query )
95112 } ,
You can’t perform that action at this time.
0 commit comments