OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('bookmarks', function() { | 5 cr.define('bookmarks', function() { |
6 /** | 6 /** |
7 * @param {BookmarkElement} element | 7 * @param {BookmarkElement} element |
8 * @return {boolean} | 8 * @return {boolean} |
9 */ | 9 */ |
10 function isBookmarkItem(element) { | 10 function isBookmarkItem(element) { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // Determine the selected bookmarks. | 408 // Determine the selected bookmarks. |
409 var state = store.data; | 409 var state = store.data; |
410 var draggedNodes = Array.from(state.selection.items); | 410 var draggedNodes = Array.from(state.selection.items); |
411 | 411 |
412 // Change selection to the dragged node if the node is not part of the | 412 // Change selection to the dragged node if the node is not part of the |
413 // existing selection. | 413 // existing selection. |
414 if (isBookmarkFolderNode(dragElement) || | 414 if (isBookmarkFolderNode(dragElement) || |
415 draggedNodes.indexOf(dragId) == -1) { | 415 draggedNodes.indexOf(dragId) == -1) { |
416 store.dispatch(bookmarks.actions.deselectItems()); | 416 store.dispatch(bookmarks.actions.deselectItems()); |
417 if (!isBookmarkFolderNode(dragElement)) { | 417 if (!isBookmarkFolderNode(dragElement)) { |
418 store.dispatch( | 418 store.dispatch(bookmarks.actions.selectItem(dragId, state, { |
419 bookmarks.actions.selectItem(dragId, true, false, state)); | 419 clear: false, |
| 420 range: false, |
| 421 toggle: false, |
| 422 })); |
420 } | 423 } |
421 draggedNodes = [dragId]; | 424 draggedNodes = [dragId]; |
422 } | 425 } |
423 | 426 |
424 e.preventDefault(); | 427 e.preventDefault(); |
425 | 428 |
426 // If we are dragging a single link, we can do the *Link* effect. | 429 // If we are dragging a single link, we can do the *Link* effect. |
427 // Otherwise, we only allow copy and move. | 430 // Otherwise, we only allow copy and move. |
428 if (e.dataTransfer) { | 431 if (e.dataTransfer) { |
429 e.dataTransfer.effectAllowed = | 432 e.dataTransfer.effectAllowed = |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 this.dropIndicator_.setTimeout = this.setTimeout_; | 634 this.dropIndicator_.setTimeout = this.setTimeout_; |
632 } | 635 } |
633 }; | 636 }; |
634 | 637 |
635 return { | 638 return { |
636 DNDManager: DNDManager, | 639 DNDManager: DNDManager, |
637 DragInfo: DragInfo, | 640 DragInfo: DragInfo, |
638 DropIndicator: DropIndicator, | 641 DropIndicator: DropIndicator, |
639 }; | 642 }; |
640 }); | 643 }); |
OLD | NEW |