| 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 add: true, |
| 420 range: false, |
| 421 toggle: false, |
| 422 updateAnchor: true, |
| 423 })); |
| 420 } | 424 } |
| 421 draggedNodes = [dragId]; | 425 draggedNodes = [dragId]; |
| 422 } | 426 } |
| 423 | 427 |
| 424 e.preventDefault(); | 428 e.preventDefault(); |
| 425 | 429 |
| 426 // If we are dragging a single link, we can do the *Link* effect. | 430 // If we are dragging a single link, we can do the *Link* effect. |
| 427 // Otherwise, we only allow copy and move. | 431 // Otherwise, we only allow copy and move. |
| 428 if (e.dataTransfer) { | 432 if (e.dataTransfer) { |
| 429 e.dataTransfer.effectAllowed = | 433 e.dataTransfer.effectAllowed = |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 this.dropIndicator_.setTimeout = this.setTimeout_; | 635 this.dropIndicator_.setTimeout = this.setTimeout_; |
| 632 } | 636 } |
| 633 }; | 637 }; |
| 634 | 638 |
| 635 return { | 639 return { |
| 636 DNDManager: DNDManager, | 640 DNDManager: DNDManager, |
| 637 DragInfo: DragInfo, | 641 DragInfo: DragInfo, |
| 638 DropIndicator: DropIndicator, | 642 DropIndicator: DropIndicator, |
| 639 }; | 643 }; |
| 640 }); | 644 }); |
| OLD | NEW |