2
2
import type { TerminalTab } from ' @commas/types/terminal'
3
3
import * as commas from ' commas:api/renderer'
4
4
import normalizeURL from ' normalize-url'
5
- import { nextTick , watchEffect } from ' vue'
5
+ import { watchEffect } from ' vue'
6
6
7
7
const { tab } = defineProps <{
8
8
tab: TerminalTab ,
9
9
}>()
10
10
11
- const { TerminalPane, WebContents, VisualIcon } = commas .ui .vueAssets
11
+ const { TerminalPane, WebContents, VisualIcon, vI18n } = commas .ui .vueAssets
12
12
13
13
let url = $computed ({
14
14
get : () => tab .command ,
@@ -41,22 +41,13 @@ function goBack() {
41
41
view .goToOffset (- 1 )
42
42
}
43
43
44
- let isCustomizing = $ref (false )
45
44
let customURL: string | undefined = $ref <string >()
46
45
let customURLElement = $ref <HTMLInputElement >()
47
46
48
47
watchEffect (() => {
49
48
customURL = url
50
49
})
51
50
52
- async function startCustomization() {
53
- isCustomizing = true
54
- await nextTick ()
55
- if (customURLElement ) {
56
- customURLElement .select ()
57
- }
58
- }
59
-
60
51
async function customize() {
61
52
if (customURL && customURL !== url ) {
62
53
url = normalizeURL (customURL , {
@@ -69,12 +60,10 @@ async function customize() {
69
60
sortQueryParameters: false ,
70
61
})
71
62
}
72
- isCustomizing = false
73
63
}
74
64
75
65
function resetCustomization() {
76
66
customURL = url
77
- isCustomizing = false
78
67
}
79
68
80
69
function autoselect(event : FocusEvent ) {
@@ -107,18 +96,18 @@ watchEffect((onInvalidate) => {
107
96
<button type =" button" data-commas :class =" ['browser-action', { disabled: !view?.canGoBack }]" @click =" goBack" >
108
97
<VisualIcon name =" lucide-undo-2" />
109
98
</button >
110
- <form v-if = " isCustomizing " class =" custom-url-form" @submit.prevent =" customize" >
99
+ <form class =" custom-url-form" @submit.prevent =" customize" >
111
100
<input
112
101
ref =" customURLElement"
113
102
v-model =" customURL"
103
+ v-i18n:placeholder
114
104
class =" custom-url"
105
+ placeholder =" Enter URL...#!browser.4"
115
106
autofocus
116
107
@focus =" autoselect"
117
- @blur =" resetCustomization"
118
108
@keydown.esc =" resetCustomization"
119
109
>
120
110
</form >
121
- <span v-else class =" page-url" @click =" startCustomization" >{{ url }}</span >
122
111
<button type =" button" data-commas :class =" ['browser-action', { disabled: !url }]" @click =" openExternal" >
123
112
<VisualIcon name =" lucide-square-arrow-out-up-right" />
124
113
</button >
@@ -176,17 +165,6 @@ watchEffect((onInvalidate) => {
176
165
background : transparent ;
177
166
outline : none ;
178
167
}
179
- .page-url {
180
- display : flex ;
181
- flex : 1 ;
182
- align-self : stretch ;
183
- align-items : center ;
184
- min-width : 0 ;
185
- font-size : 12px ;
186
- white-space : nowrap ;
187
- text-overflow : ellipsis ;
188
- overflow : hidden ;
189
- }
190
168
.web-page {
191
169
flex : 1 ;
192
170
min-height : 0 ;
0 commit comments