1
1
<template >
2
2
<scroll-pane >
3
3
<action-header v-show =" hasTarget" slot =" header" >
4
- <span class =" title" @click = " onTitleClick " >
4
+ <span class =" title" >
5
5
<span class =" title-bracket" >< ; </span >
6
- <span v-tooltip = " titleTooltip " >{{ targetName }}</span >
6
+ <span >{{ targetName }}</span >
7
7
<span class =" title-bracket" >> ; </span >
8
8
</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 >
13
9
<div class =" search" >
14
10
<i class =" material-icons" >search</i >
15
11
<input placeholder =" Filter inspected data" v-model.trim =" filter" >
16
12
</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 >
17
31
</action-header >
18
32
<template slot="scroll">
19
33
<section v-if =" !hasTarget" class =" notice" >
@@ -68,8 +82,8 @@ export default {
68
82
}, this .filter )
69
83
})), ' type' )
70
84
},
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 `
73
87
}
74
88
},
75
89
methods: {
@@ -83,28 +97,26 @@ export default {
83
97
window .alert (' DOM inspection is not supported in this shell.' )
84
98
}
85
99
},
86
- onTitleClick () {
100
+ openInEditor () {
87
101
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')
92
109
} 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')
100
111
}
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')
107
113
}
114
+ })`
115
+ if (this .$isChrome ) {
116
+ chrome .devtools .inspectedWindow .eval (src)
117
+ } else {
118
+ // eslint-disable-next-line no-eval
119
+ eval (src)
108
120
}
109
121
}
110
122
}
@@ -113,7 +125,6 @@ export default {
113
125
114
126
<style lang="stylus" scoped>
115
127
.title
116
- cursor pointer
117
128
white-space nowrap
118
129
</style >
119
130
0 commit comments