@@ -26,7 +26,7 @@ define([
26
26
filterChips : '${ $.filterChipsProvider }'
27
27
} ,
28
28
listens : {
29
- '${ $.provider }:params.filters.path' : 'clearFiltersHandle '
29
+ '${ $.provider }:params.filters.path' : 'updateSelectedDirectory '
30
30
} ,
31
31
viewConfig : [ {
32
32
component : 'Magento_MediaGalleryUi/js/directory/directories' ,
@@ -220,7 +220,7 @@ define([
220
220
this . firejsTreeEvents ( ) ;
221
221
} . bind ( this ) ) ;
222
222
} else {
223
- this . checkChipFiltersState ( ) ;
223
+ this . updateSelectedDirectory ( ) ;
224
224
}
225
225
} . bind ( this ) ) ;
226
226
} . bind ( this ) ) ;
@@ -239,15 +239,15 @@ define([
239
239
} . bind ( this ) ) ;
240
240
241
241
$ ( this . directoryTreeSelector ) . on ( 'loaded.jstree' , function ( ) {
242
- this . checkChipFiltersState ( ) ;
242
+ this . updateSelectedDirectory ( ) ;
243
243
} . bind ( this ) ) ;
244
244
245
245
} ,
246
246
247
247
/**
248
248
* Verify directory filter on init event, select folder per directory filter state
249
249
*/
250
- checkChipFiltersState : function ( ) {
250
+ updateSelectedDirectory : function ( ) {
251
251
var currentFilterPath = this . filterChips ( ) . filters . path ,
252
252
isMediaBrowser = ! _ . isUndefined ( window . MediabrowserUtility ) ,
253
253
currentTreePath ;
@@ -260,6 +260,12 @@ define([
260
260
} else {
261
261
this . selectStorageRoot ( ) ;
262
262
}
263
+
264
+ if ( _ . isUndefined ( currentFilterPath ) ) {
265
+ $ ( this . directoryTreeSelector ) . jstree ( 'deselect_all' ) ;
266
+ this . activeNode ( null ) ;
267
+ this . directories ( ) . setInActive ( ) ;
268
+ }
263
269
} ,
264
270
265
271
/**
@@ -281,8 +287,7 @@ define([
281
287
* @param {String } currentFilterPath
282
288
*/
283
289
isFiltersApplied : function ( currentFilterPath ) {
284
- return ! _ . isUndefined ( currentFilterPath ) && currentFilterPath !== '' &&
285
- currentFilterPath !== 'wysiwyg' && currentFilterPath !== 'catalog/category' ;
290
+ return ! _ . isUndefined ( currentFilterPath ) ;
286
291
} ,
287
292
288
293
/**
@@ -302,17 +307,6 @@ define([
302
307
303
308
} ,
304
309
305
- /**
306
- * Listener to clear filters event
307
- */
308
- clearFiltersHandle : function ( ) {
309
- if ( _ . isUndefined ( this . filterChips ( ) . filters . path ) ) {
310
- $ ( this . directoryTreeSelector ) . jstree ( 'deselect_all' ) ;
311
- this . activeNode ( null ) ;
312
- this . directories ( ) . setInActive ( ) ;
313
- }
314
- } ,
315
-
316
310
/**
317
311
* Set active node filter, or deselect if the same node clicked
318
312
*
0 commit comments