Skip to content

501 - Encode file path as URI + fix console display on Windows #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 19, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/devtools/views/components/ComponentInspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,21 @@ export default {
},
openInEditor () {
const file = this.target.file
const src = `fetch('/__open-in-editor?file=${file}').then(response => {
// Console display
const fileName = file.replace(/\\/g, '\\\\')
const src = `fetch('/__open-in-editor?file=${encodeURI(file)}').then(response => {
if (response.ok) {
console.log('File ${file} opened in editor')
console.log('File ${fileName} opened in editor')
} else {
const msg = 'Opening component ${file} failed'
const msg = 'Opening component ${fileName} failed'
if (__VUE_DEVTOOLS_TOAST__) {
__VUE_DEVTOOLS_TOAST__(msg, 'error')
} else {
console.log('%c' + msg, 'color:red')
}
console.log('Check the setup of your project, see https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md')
}
console.log('Check the setup of your project, see https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you put the same console.log on purpose here? In case the response is not ok you'll get 2 same logs in the console.

})`
if (this.$isChrome) {
chrome.devtools.inspectedWindow.eval(src)
Expand All @@ -127,4 +130,3 @@ export default {
.title
white-space nowrap
</style>