diff --git a/svelte/src/filesystem/Filesystem.svelte b/svelte/src/filesystem/Filesystem.svelte index b9cc09e..a19feae 100644 --- a/svelte/src/filesystem/Filesystem.svelte +++ b/svelte/src/filesystem/Filesystem.svelte @@ -71,7 +71,7 @@ const keydown = e => { break; case "/": case "f": - view = "search" + search() break case "a": case "ArrowLeft": @@ -89,6 +89,19 @@ const keydown = e => { const download = () => { download_frame.src = fs_file_url(state.root.id, state.base.path) + "?attach" } + +const search = async () => { + if (view === "search") { + view = "file" + return + } + + if (state.base.type !== "dir") { + await fs_navigator.navigate(state.path[state.path.length-2].path) + } + + view = "search" +} @@ -98,12 +111,11 @@ const download = () => { { - view = "file"; - await tick(); - file_preview.state_update(); - }} on:loading={e => loading = e.detail} + on:navigation_complete={() => { + // Reset the view to the file view if we were in search view + view = "file" + }} />
@@ -133,6 +145,7 @@ const download = () => { bind:edit_visible={edit_visible} bind:view={view} on:download={download} + on:search={search} />
diff --git a/svelte/src/filesystem/Toolbar.svelte b/svelte/src/filesystem/Toolbar.svelte index c2068cf..4b14adf 100644 --- a/svelte/src/filesystem/Toolbar.svelte +++ b/svelte/src/filesystem/Toolbar.svelte @@ -64,13 +64,6 @@ let share = async () => { sharebar_visible = !sharebar_visible } } -let toggle_search = () => { - if (view === "search") { - view = "file" - } else { - view = "search" - } -}
@@ -102,8 +95,8 @@ let toggle_search = () => {
- {#if state.root.id === "me" && state.base.type === "dir"} - {/if} @@ -114,10 +107,6 @@ let toggle_search = () => { {/if} - - {#if share_url !== ""}