-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Switching between Media Gallery bookmarks does not change the selected folder #29411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
8020a01
8e1e390
ee2ab23
e94ffe6
3396cfd
20dc815
58efb76
60da76c
a516ee5
0d0aa22
eb1f0bb
36074a9
9a69a6a
79c8386
4a354da
ae61599
a68bbbd
e533396
218c017
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ define([ | |
filterChips: '${ $.filterChipsProvider }' | ||
}, | ||
listens: { | ||
'${ $.provider }:params.filters.path': 'clearFiltersHandle' | ||
'${ $.provider }:params.filters.path': 'updateSelectedDirectory' | ||
}, | ||
viewConfig: [{ | ||
component: 'Magento_MediaGalleryUi/js/directory/directories', | ||
|
@@ -220,7 +220,7 @@ define([ | |
this.firejsTreeEvents(); | ||
}.bind(this)); | ||
} else { | ||
this.checkChipFiltersState(); | ||
this.updateSelectedDirectory(); | ||
} | ||
}.bind(this)); | ||
}.bind(this)); | ||
|
@@ -239,26 +239,30 @@ define([ | |
}.bind(this)); | ||
|
||
$(this.directoryTreeSelector).on('loaded.jstree', function () { | ||
this.checkChipFiltersState(); | ||
this.updateSelectedDirectory(); | ||
}.bind(this)); | ||
|
||
}, | ||
|
||
/** | ||
* Verify directory filter on init event, select folder per directory filter state | ||
*/ | ||
checkChipFiltersState: function () { | ||
updateSelectedDirectory: function () { | ||
var currentFilterPath = this.filterChips().filters.path, | ||
isMediaBrowser = !_.isUndefined(window.MediabrowserUtility), | ||
currentTreePath; | ||
|
||
currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath : | ||
Base64.idDecode(window.MediabrowserUtility.pathId); | ||
|
||
if (this.folderExistsInTree(currentTreePath)) { | ||
this.locateNode(currentTreePath); | ||
if (_.isUndefined(currentFilterPath)) { | ||
this.clearFiltersHandle(); | ||
} else { | ||
this.selectStorageRoot(); | ||
currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath : | ||
Base64.idDecode(window.MediabrowserUtility.pathId); | ||
|
||
if (this.folderExistsInTree(currentTreePath)) { | ||
this.locateNode(currentTreePath); | ||
} else { | ||
this.selectStorageRoot(); | ||
} | ||
} | ||
}, | ||
|
||
|
@@ -281,8 +285,8 @@ define([ | |
* @param {String} currentFilterPath | ||
*/ | ||
isFiltersApplied: function (currentFilterPath) { | ||
return !_.isUndefined(currentFilterPath) && currentFilterPath !== '' && | ||
currentFilterPath !== 'wysiwyg' && currentFilterPath !== 'catalog/category'; | ||
return !_.isUndefined(currentFilterPath) && currentFilterPath !== '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comparisons needed to cover behavior with pres elected folders, for example when bookmark applied and we open media gallery from category, category folder should be presented only if the bookmarks not available |
||
&& currentFilterPath !== 'catalog/category'; | ||
}, | ||
|
||
/** | ||
|
@@ -302,15 +306,10 @@ define([ | |
|
||
}, | ||
|
||
/** | ||
* Listener to clear filters event | ||
*/ | ||
clearFiltersHandle: function () { | ||
if (_.isUndefined(this.filterChips().filters.path)) { | ||
$(this.directoryTreeSelector).jstree('deselect_all'); | ||
this.activeNode(null); | ||
this.directories().setInActive(); | ||
} | ||
$(this.directoryTreeSelector).jstree('deselect_all'); | ||
this.activeNode(null); | ||
this.directories().setInActive(); | ||
}, | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.