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

Unified Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2871573004: [MD Bookmarks] Make dragging update selected items. (Closed)
Patch Set: Created 3 years, 7 months 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 | « no previous file | chrome/test/data/webui/md_bookmarks/dnd_manager_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/dnd_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/dnd_manager.js b/chrome/browser/resources/md_bookmarks/dnd_manager.js
index ffe166106a1d208167cbe371625e71805dc2a12b..2520096b5571edb426427dd743af50eba80301df 100644
--- a/chrome/browser/resources/md_bookmarks/dnd_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dnd_manager.js
@@ -371,7 +371,6 @@ cr.define('bookmarks', function() {
parentId = assert(node.parentId);
index = state.nodes[parentId].children.indexOf(node.id);
- // TODO(calamity): Handle dropping to an empty bookmark list.
calamity 2017/05/12 04:11:32 This was taken care of in another CL and just gett
if (position == DropPosition.BELOW)
index++;
}
@@ -403,14 +402,23 @@ cr.define('bookmarks', function() {
if (!dragElement)
return;
+ var store = bookmarks.Store.getInstance();
+ var dragId = dragElement.itemId;
+
// Determine the selected bookmarks.
- var state = bookmarks.Store.getInstance().data;
+ var state = store.data;
var draggedNodes = Array.from(state.selection.items);
+ // Change selection to the dragged node if the node is not part of the
+ // existing selection.
if (isBookmarkFolderNode(dragElement) ||
- draggedNodes.indexOf(dragElement.itemId) == -1) {
- // TODO(calamity): clear current selection.
- draggedNodes = [dragElement.itemId];
+ draggedNodes.indexOf(dragId) == -1) {
+ store.handleAction(bookmarks.actions.deselectItems());
tsergeant 2017/05/12 06:03:24 You'll need to rebase to pick up the rename of thi
calamity 2017/05/12 06:32:42 Done.
+ if (!isBookmarkFolderNode(dragElement)) {
+ store.handleAction(
+ bookmarks.actions.selectItem(dragId, true, false, state));
+ }
+ draggedNodes = [dragId];
}
e.preventDefault();
« no previous file with comments | « no previous file | chrome/test/data/webui/md_bookmarks/dnd_manager_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698