From 24b783e5fb93106036a0e8db5518433046400471 Mon Sep 17 00:00:00 2001 From: wukko Date: Mon, 22 Jul 2024 09:55:04 +0600 Subject: [PATCH] web/Omnibox: remember the link input when switching between tabs --- web/src/components/save/Omnibox.svelte | 14 ++++++++++++++ web/src/lib/state/omnibox.ts | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 web/src/lib/state/omnibox.ts diff --git a/web/src/components/save/Omnibox.svelte b/web/src/components/save/Omnibox.svelte index 1057d0c5..c032e6a8 100644 --- a/web/src/components/save/Omnibox.svelte +++ b/web/src/components/save/Omnibox.svelte @@ -7,7 +7,9 @@ import dialogs from "$lib/dialogs"; + import { storedLink } from "$lib/state/omnibox"; import { updateSetting } from "$lib/state/settings"; + import type { DownloadModeOption } from "$lib/types/settings"; import type { Optional } from "$lib/types/generic"; @@ -29,6 +31,18 @@ let linkInput: Optional; let isFocused = false; + let stored; + + $: storedLink.set(link); + + storedLink.subscribe((value) => { + stored = value; + }); + + if (!link && stored) { + link = stored + } + let isDisabled: boolean = false; let downloadButton: SvelteComponent; diff --git a/web/src/lib/state/omnibox.ts b/web/src/lib/state/omnibox.ts new file mode 100644 index 00000000..a882abce --- /dev/null +++ b/web/src/lib/state/omnibox.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const storedLink = writable();