This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 972
unable to drag/drop the un/lock icon onto a folder on Bookmarks Toolbar #11180
Labels
Milestone
Comments
I know we don't support this for uri's drag data types right now yet, but since this was supported before this shows that our url bar icon is now being detected as a uri drag type and not as some internal one. |
Ignore last comment this is just another independent bug. The bug is in: |
I know if you drop onto the chevron, it seems to work (perhaps because that triggers the menu opening up really quickly). Although, that's far from ideal 😄 |
regressed here: Because |
Still working on this but in case someone wants to pickup where I left off, here's my current WIP diff: diff --git a/app/renderer/components/bookmarks/bookmarksToolbar.js b/app/renderer/components/bookmarks/bookmarksToolbar.js
index 485a66828..2e969e9c7 100644
--- a/app/renderer/components/bookmarks/bookmarksToolbar.js
+++ b/app/renderer/components/bookmarks/bookmarksToolbar.js
@@ -32,6 +32,7 @@ const dndData = require('../../../../js/dndData')
const isWindows = require('../../../common/lib/platformUtil').isWindows()
const frameStateUtil = require('../../../../js/state/frameStateUtil')
const bookmarkUtil = require('../../../common/lib/bookmarkUtil')
+const siteUtil = require('../../../../js/state/siteUtil')
// Styles
const globalStyles = require('../styles/global')
@@ -58,13 +59,13 @@ class BookmarksToolbar extends React.Component {
const bookmark = dnd.prepareBookmarkDataFromCompatible(e.dataTransfer)
if (bookmark) {
// Figure out the droppedOn element filtering out the source drag item
- const bookmarkKey = bookmark.get('bookmarkKey')
+ const bookmarkKey = bookmark.get('bookmarkKey') || siteUtil.getSiteKey(bookmark)
const droppedOn = getClosestFromPos(e.clientX, bookmarkKey)
if (droppedOn.selectedRef) {
const isLeftSide = dnd.isLeftSide(ReactDOM.findDOMNode(droppedOn.selectedRef), e.clientX)
const droppedOnKey = droppedOn.selectedRef.props.bookmarkKey
const isDestinationParent = droppedOn.selectedRef.state.isFolder && droppedOn && droppedOn.isDroppedOn
- appActions.moveSite(bookmark.get('bookmarkKey'), droppedOnKey, isLeftSide, isDestinationParent)
+ appActions.moveSite(bookmarkKey, droppedOnKey, isLeftSide, isDestinationParent)
dnd.onDragEnd()
}
return
diff --git a/app/renderer/components/navigation/urlBarIcon.js b/app/renderer/components/navigation/urlBarIcon.js
index 1fd6fcaaa..9675b6bd3 100644
--- a/app/renderer/components/navigation/urlBarIcon.js
+++ b/app/renderer/components/navigation/urlBarIcon.js
@@ -112,7 +112,10 @@ class UrlBarIcon extends React.Component {
onDragStart (e) {
dndData.setupDataTransferURL(e.dataTransfer, this.props.location, this.props.title)
dndData.setupDataTransferBraveData(e.dataTransfer, dragTypes.TAB, {
- tabId: this.props.tabId
+ tabId: this.props.tabId,
+ location: this.props.location,
+ title: this.props.title,
+ partitionNumber: this.props.partitionNumber
})
}
@@ -140,6 +143,7 @@ class UrlBarIcon extends React.Component {
// used in other functions
props.title = activeFrame.get('title', '')
+ props.partitionNumber = activeFrame.get('partitionNumber', 0)
props.tabId = activeFrame.get('tabId', tabState.TAB_ID_NONE)
return props
diff --git a/js/dnd.js b/js/dnd.js
index 6841f8cdc..dff238cc3 100644
--- a/js/dnd.js
+++ b/js/dnd.js
@@ -7,8 +7,10 @@ const appActions = require('./actions/appActions')
const ReactDOM = require('react-dom')
const dndData = require('./dndData')
const dragTypes = require('./constants/dragTypes')
+const siteTags = require('./constants/siteTags')
const appStoreRenderer = require('./stores/appStoreRenderer')
const {getCurrentWindowId} = require('../app/renderer/currentWindow')
+const siteUtil = require('./state/siteUtil')
const {ESC} = require('../app/common/constants/keyCodes.js')
module.exports.getInterBraveDragData = () => {
@@ -135,9 +137,12 @@ module.exports.isMiddle = (domNode, clientX) => {
module.exports.prepareBookmarkDataFromCompatible = (dataTransfer) => {
let bookmark = dndData.getDragData(dataTransfer, dragTypes.BOOKMARK)
if (!bookmark) {
- const dragData = dndData.getDragData(dataTransfer, dragTypes.TAB)
- if (dragData) {
- windowActions.onFrameBookmark(dragData.get('tabId'))
+ const frameProps = dndData.getDragData(dataTransfer, dragTypes.TAB)
+ if (frameProps) {
+ console.log('frameProps:', frameProps.toJS())
+ bookmark = siteUtil.getDetailFromFrame(frameProps, siteTags.BOOKMARK)
+ console.log('bookmark:', bookmark.toJS())
+ windowActions.onFrameBookmark(frameProps.get('tabId'))
}
}
return bookmark
I'll work on it more nights as I can while on PTO. |
bbondy
added a commit
that referenced
this issue
Oct 1, 2017
Fix #11180 This mostly just reverts a subset of: d82f171 This is only for 0.19.x and 0.20.x Master can get a better fix so tests and refactoring will be done in: #11226 Since the tests would not be valid past 0.20.x I'm not covering any new 0.19.x and 0.20.x only tests here. Also we don't have drag and drop under tets at all. In master with the refactor since we have bookmark toolbar width in state we'll be able to do everything in the reducer and so also be able to add tests. Auditors: @bsclifton
bbondy
added a commit
that referenced
this issue
Oct 1, 2017
Fix #11180 This mostly just reverts a subset of: d82f171 This is only for 0.19.x and 0.20.x Master can get a better fix so tests and refactoring will be done in: #11226 Since the tests would not be valid past 0.20.x I'm not covering any new 0.19.x and 0.20.x only tests here. Also we don't have drag and drop under tets at all. In master with the refactor since we have bookmark toolbar width in state we'll be able to do everything in the reducer and so also be able to add tests. Auditors: @bsclifton
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Description
In 0.19.20 when you drag and drop the un/lock icon from the URL bar onto a folder in the Bookmarks toolbar, the bookmark is not added into the Folder, it is added to the bookmarks toolbar.
Steps to Reproduce
Actual result:
Bookmark is not added into the folder, it is added onto the toolbar:
Expected result:
Bookmark should be added to the folder after drag/drop of un/lock icon as it is in 0.18.36:
Reproduces how often: 100%
Brave Version
about:brave info:
Brave | 0.19.20
rev | d9566ab
Muon | 4.4.25
Reproducible on current live release:
No
Additional Information
The text was updated successfully, but these errors were encountered: