|
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;
|
|
145 | 150 | globalThis.qwikOpenInEditor = function (path) {
|
146 | 151 | const isWindows = navigator.platform.includes('Win');
|
147 | 152 | const resolvedURL = new URL(path, isWindows ? origin : srcDir);
|
148 |
| - if (resolvedURL.origin === origin) { |
149 |
| - const params = new URLSearchParams(); |
150 |
| - const prefix = isWindows ? srcDir : ''; |
151 |
| - params.set('file', prefix + resolvedURL.pathname); |
152 |
| - 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; |
153 | 162 | } else {
|
154 |
| - 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; |
155 | 167 | }
|
| 168 | + params.set('file', finalPath); |
| 169 | + fetch('/__open-in-editor?' + params.toString()); |
156 | 170 | };
|
157 | 171 | document.addEventListener(
|
158 | 172 | 'contextmenu',
|
|
0 commit comments