Skip to content

Commit a79d9c5

Browse files
anteriovieiraGuillaume Chau
authored and
Guillaume Chau
committed
Minor adjustments (#495)
* Minor adjustments * Style + tooltip tweaks * Remove title pointer * Hide button if no file * Remove unecessary if
1 parent f77b51e commit a79d9c5

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

src/devtools/global.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ $arrow-color = #444
311311
.mono
312312
font-family Menlo, Consolas, monospace
313313

314+
.green
315+
&,
316+
.material-icons
317+
color $green
318+
314319
.input-example
315320
background $white
316321
color $green

src/devtools/views/components/ComponentInspector.vue

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
<template>
22
<scroll-pane>
33
<action-header v-show="hasTarget" slot="header">
4-
<span class="title" @click="onTitleClick">
4+
<span class="title">
55
<span class="title-bracket">&lt;</span>
6-
<span v-tooltip="titleTooltip">{{ targetName }}</span>
6+
<span>{{ targetName }}</span>
77
<span class="title-bracket">&gt;</span>
88
</span>
9-
<a v-if="$isChrome" class="button inspect" @click="inspectDOM" v-tooltip="'Inspect DOM'">
10-
<i class="material-icons">find_in_page</i>
11-
<span>Inspect DOM</span>
12-
</a>
139
<div class="search">
1410
<i class="material-icons">search</i>
1511
<input placeholder="Filter inspected data" v-model.trim="filter">
1612
</div>
13+
<a
14+
v-if="$isChrome"
15+
class="button inspect"
16+
v-tooltip="'Inspect DOM'"
17+
@click="inspectDOM"
18+
>
19+
<i class="material-icons">code</i>
20+
<span>Inspect DOM</span>
21+
</a>
22+
<a
23+
v-if="target.file"
24+
class="button"
25+
v-tooltip="openEditorTooltip"
26+
@click="openInEditor"
27+
>
28+
<i class="material-icons">launch</i>
29+
<span>Open in editor</span>
30+
</a>
1731
</action-header>
1832
<template slot="scroll">
1933
<section v-if="!hasTarget" class="notice">
@@ -68,8 +82,8 @@ export default {
6882
}, this.filter)
6983
})), 'type')
7084
},
71-
titleTooltip () {
72-
return this.target.file && `Open <i class="material-icons">insert_drive_file</i> <span class="mono">${this.target.file}</span>`
85+
openEditorTooltip () {
86+
return this.target.file && `Open <span class="mono green"><i class="material-icons">insert_drive_file</i>${this.target.file}</span> in editor`
7387
}
7488
},
7589
methods: {
@@ -83,28 +97,26 @@ export default {
8397
window.alert('DOM inspection is not supported in this shell.')
8498
}
8599
},
86-
onTitleClick () {
100+
openInEditor () {
87101
const file = this.target.file
88-
if (file) {
89-
const src = `fetch('/__open-in-editor?file=${file}').then(response => {
90-
if (response.ok) {
91-
console.log('File ${file} opened in editor')
102+
const src = `fetch('/__open-in-editor?file=${file}').then(response => {
103+
if (response.ok) {
104+
console.log('File ${file} opened in editor')
105+
} else {
106+
const msg = 'Opening component ${file} failed'
107+
if (__VUE_DEVTOOLS_TOAST__) {
108+
__VUE_DEVTOOLS_TOAST__(msg, 'error')
92109
} else {
93-
const msg = 'Opening component ${file} failed'
94-
if (__VUE_DEVTOOLS_TOAST__) {
95-
__VUE_DEVTOOLS_TOAST__(msg, 'error')
96-
} else {
97-
console.log('%c' + msg, 'color:red')
98-
}
99-
console.log('Check the setup of your project, see https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md')
110+
console.log('%c' + msg, 'color:red')
100111
}
101-
})`
102-
if (this.$isChrome) {
103-
chrome.devtools.inspectedWindow.eval(src)
104-
} else {
105-
// eslint-disable-next-line no-eval
106-
eval(src)
112+
console.log('Check the setup of your project, see https://github.com/vuejs/vue-devtools/blob/master/docs/open-in-editor.md')
107113
}
114+
})`
115+
if (this.$isChrome) {
116+
chrome.devtools.inspectedWindow.eval(src)
117+
} else {
118+
// eslint-disable-next-line no-eval
119+
eval(src)
108120
}
109121
}
110122
}
@@ -113,7 +125,6 @@ export default {
113125

114126
<style lang="stylus" scoped>
115127
.title
116-
cursor pointer
117128
white-space nowrap
118129
</style>
119130

0 commit comments

Comments
 (0)