|
10 | 10 | cursor: pointer; |
11 | 11 | z-index: 999999; |
12 | 12 | } |
| 13 | + |
13 | 14 | #qwik-inspector-info-popup { |
14 | 15 | position: fixed; |
15 | 16 | bottom: 10px; |
|
28 | 29 | z-index: 999999; |
29 | 30 | contain: layout; |
30 | 31 | } |
| 32 | + |
31 | 33 | #qwik-inspector-info-popup p { |
32 | 34 | margin: 0px; |
33 | 35 | } |
| 36 | + |
34 | 37 | @-webkit-keyframes fadeOut { |
35 | 38 | 0% { |
36 | 39 | opacity: 1; |
37 | 40 | } |
| 41 | + |
38 | 42 | 100% { |
39 | 43 | opacity: 0; |
40 | 44 | } |
|
44 | 48 | 0% { |
45 | 49 | opacity: 1; |
46 | 50 | } |
| 51 | + |
47 | 52 | 100% { |
48 | 53 | opacity: 0; |
49 | 54 | visibility: hidden; |
|
144 | 149 |
|
145 | 150 | globalThis.qwikOpenInEditor = function (path) { |
146 | 151 | const isWindows = navigator.platform.includes('Win'); |
147 | | - const isMac = navigator.platform.includes('Mac'); |
148 | 152 | const resolvedURL = new URL(path, isWindows ? origin : srcDir); |
149 | | - const prefix = isWindows ? srcDir : ''; |
150 | | - if (isWindows || isMac) { |
151 | | - let finalPath; |
152 | | - const params = new URLSearchParams(); |
153 | | - const filePath = |
154 | | - resolvedURL.protocol === 'file:' && resolvedURL.pathname.startsWith('/') |
155 | | - ? resolvedURL.pathname.slice(1) |
156 | | - : resolvedURL.pathname; |
157 | | - if (filePath.startsWith(prefix)) { |
158 | | - finalPath = filePath; |
159 | | - } else { |
160 | | - const cleaned = filePath.replace(/^[/\\]?src[/\\]/, ''); |
161 | | - const sep = '\\'; |
162 | | - finalPath = prefix.endsWith(sep) ? prefix + cleaned : prefix + sep + cleaned; |
163 | | - } |
164 | | - params.set('file', finalPath); |
165 | | - fetch('/__open-in-editor?' + params.toString()); |
| 153 | + const prefix = isWindows ? srcDir : srcDir.replace('http://local.local', ''); |
| 154 | + const params = new URLSearchParams(); |
| 155 | + const filePath = |
| 156 | + resolvedURL.protocol === 'file:' && resolvedURL.pathname.startsWith('/') |
| 157 | + ? resolvedURL.pathname.slice(1) |
| 158 | + : resolvedURL.pathname; |
| 159 | + let finalPath; |
| 160 | + if (filePath.startsWith(prefix)) { |
| 161 | + finalPath = filePath; |
166 | 162 | } else { |
167 | | - location.href = resolvedURL.href; |
| 163 | + // remove the extra src from filePath as prefix already contains it |
| 164 | + const cleaned = filePath.replace(/^[/\\]?src[/\\]/, ''); |
| 165 | + const sep = isWindows ? '\\' : '/'; |
| 166 | + finalPath = prefix.endsWith(sep) ? prefix + cleaned : prefix + sep + cleaned; |
168 | 167 | } |
| 168 | + params.set('file', finalPath); |
| 169 | + fetch('/__open-in-editor?' + params.toString()); |
169 | 170 | }; |
170 | 171 | document.addEventListener( |
171 | 172 | 'contextmenu', |
|
0 commit comments