This repository was archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 970
(Drag and drop) get full path from custom data in dataTransfer.items from https://git… #9700
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ const {getCurrentWindowId, isMaximized, isFullScreen, isFocused} = require('../. | |
const {isWindows} = require('../../../common/lib/platformUtil') | ||
const {braveShieldsEnabled} = require('../../../common/state/shieldState') | ||
const eventUtil = require('../../../../js/lib/eventUtil') | ||
const {isNavigatableAboutPage, getBaseUrl, fileUrl} = require('./../../../../js/lib/appUrlUtil') | ||
const {isNavigatableAboutPage, getBaseUrl} = require('./../../../../js/lib/appUrlUtil') | ||
const frameStateUtil = require('../../../../js/state/frameStateUtil') | ||
const siteSettings = require('../../../../js/state/siteSettings') | ||
const cx = require('../../../../js/lib/classSet') | ||
|
@@ -115,9 +115,10 @@ class Navigator extends React.Component { | |
|
||
onDrop (e) { | ||
if (e.dataTransfer.files.length > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
Array.from(e.dataTransfer.files).forEach((file) => { | ||
const path = fileUrl(file.path) | ||
appActions.createTabRequested({ url: path }) | ||
Array.from(e.dataTransfer.items).forEach((item) => { | ||
if (item.kind === 'string') { | ||
appActions.createTabRequested({ url: item.type }) | ||
} | ||
}) | ||
} else if (e.dataTransfer.getData('text/plain')) { | ||
if (this.props.activeTabId) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,9 +98,10 @@ class Tabs extends React.Component { | |
} | ||
|
||
if (e.dataTransfer.files) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
Array.from(e.dataTransfer.files).forEach((file) => { | ||
const path = encodeURI(file.path) | ||
return appActions.createTabRequested({url: path, title: file.name}) | ||
Array.from(e.dataTransfer.items).forEach((item) => { | ||
if (item.kind === 'string') { | ||
return appActions.createTabRequested({url: item.type}) | ||
} | ||
}) | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should probably change from
e.dataTransfer.files.length
intoe.dataTransfer.items.length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we specifically don't want to do that because we only want these items when there are files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we didn't replace files object with items, but we only added items into dataTransfer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
files only contains the filename, not the full path. We added the full path for files into items when files are present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are limitations on what we can do with this api without breaking compatibility so rather than change what is contained in file, we added the extra data to items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, then we don't need to change this line 😃