Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: ui/file_manager/gallery/js/ribbon.js

Issue 813263002: Remove Gallery.Item when the corresponding entries are removed in file system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/image_view.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/ribbon.js
diff --git a/ui/file_manager/gallery/js/ribbon.js b/ui/file_manager/gallery/js/ribbon.js
index 4cd560ab303725bacc88667c9e376f92354cfe9b..ad57b7a3f087e2c7f9fe37978ba090a0b6c44891 100644
--- a/ui/file_manager/gallery/js/ribbon.js
+++ b/ui/file_manager/gallery/js/ribbon.js
@@ -120,11 +120,6 @@ Ribbon.prototype.disable = function() {
* @private
*/
Ribbon.prototype.onSplice_ = function(event) {
- if (event.removed.length > 1) {
- console.error('Cannot remove multiple items.');
- return;
- }
-
if (event.removed.length > 0 && event.added.length > 0) {
console.error('Replacing is not implemented.');
return;
@@ -144,12 +139,6 @@ Ribbon.prototype.onSplice_ = function(event) {
return;
}
- var removed = this.renderCache_[event.removed[0].getEntry().toURL()];
- if (!removed || !removed.parentNode || !removed.hasAttribute('selected')) {
- console.error('Can only remove the selected item');
- return;
- }
-
var persistentNodes = this.querySelectorAll('.ribbon-image:not([vanishing])');
if (this.lastVisibleIndex_ < this.dataModel_.length) { // Not at the end.
var lastNode = persistentNodes[persistentNodes.length - 1];
@@ -181,9 +170,20 @@ Ribbon.prototype.onSplice_ = function(event) {
}
}
- removed.removeAttribute('selected');
- removed.setAttribute('vanishing', 'smooth');
- this.scheduleRemove_();
+ var removed = false;
+ for (var i = 0; i < event.removed.length; i++) {
+ var removedDom = this.renderCache_[event.removed[i].getEntry().toURL()];
+ if (removedDom) {
+ removedDom.removeAttribute('selected');
+ removedDom.setAttribute('vanishing', 'smooth');
+ removed = true;
+ }
+ }
+
+ if (removed)
+ this.scheduleRemove_();
+
+ this.onSelection_();
};
/**
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/image_view.js ('k') | ui/file_manager/gallery/js/slide_mode.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698