Remove URL prefix dropdown from new browser profile screen (#1660)
Switch to a text field and prepend `https://` as prefix if no valid prefix is provided in the provided URL.
This commit is contained in:
parent
17f49a52de
commit
435ca08f26
@ -47,7 +47,7 @@ export class NewBrowserProfileDialog extends LiteElement {
|
|||||||
@reset=${this.onReset}
|
@reset=${this.onReset}
|
||||||
@submit=${this.onSubmit}
|
@submit=${this.onSubmit}
|
||||||
>
|
>
|
||||||
<div class="grid gap-5">
|
<div class="grid">
|
||||||
<div>
|
<div>
|
||||||
<label
|
<label
|
||||||
id="startingUrlLabel"
|
id="startingUrlLabel"
|
||||||
@ -57,21 +57,10 @@ export class NewBrowserProfileDialog extends LiteElement {
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<sl-select
|
|
||||||
class="mr-1 max-w-[8rem] grow-0"
|
|
||||||
name="urlPrefix"
|
|
||||||
value="https://"
|
|
||||||
hoist
|
|
||||||
@sl-hide=${this.stopProp}
|
|
||||||
@sl-after-hide=${this.stopProp}
|
|
||||||
>
|
|
||||||
<sl-option value="http://">http://</sl-option>
|
|
||||||
<sl-option value="https://">https://</sl-option>
|
|
||||||
</sl-select>
|
|
||||||
<sl-input
|
<sl-input
|
||||||
class="grow"
|
class="grow"
|
||||||
name="url"
|
name="url"
|
||||||
placeholder=${msg("example.com")}
|
placeholder=${msg("https://example.com")}
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
aria-labelledby="startingUrlLabel"
|
aria-labelledby="startingUrlLabel"
|
||||||
required
|
required
|
||||||
@ -134,13 +123,15 @@ export class NewBrowserProfileDialog extends LiteElement {
|
|||||||
this.isSubmitting = true;
|
this.isSubmitting = true;
|
||||||
|
|
||||||
const formData = new FormData(event.target as HTMLFormElement);
|
const formData = new FormData(event.target as HTMLFormElement);
|
||||||
const url = formData.get("url") as string;
|
let url = formData.get("url") as string;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
url = url.trim();
|
||||||
|
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||||
|
url = `https://${url}`;
|
||||||
|
}
|
||||||
const data = await this.createBrowser({
|
const data = await this.createBrowser({
|
||||||
url: `${formData.get("urlPrefix")?.toString()}${url.substring(
|
url: url,
|
||||||
url.indexOf(",") + 1,
|
|
||||||
)}`,
|
|
||||||
crawlerChannel: this.crawlerChannel,
|
crawlerChannel: this.crawlerChannel,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user