diff --git a/svelte/src/file_viewer/FilePicker.svelte b/svelte/src/file_viewer/FilePicker.svelte
index 36a2f63..539bb18 100644
--- a/svelte/src/file_viewer/FilePicker.svelte
+++ b/svelte/src/file_viewer/FilePicker.svelte
@@ -64,12 +64,12 @@ let done = () => {
modal.hide()
}
-
const keydown = (e) => {
- if (e.ctrlKey || e.altKey || e.metaKey) {
+ if (!modal.is_visible()) {
+ return // Prevent a closed window from catching key events
+ } else if (e.ctrlKey || e.altKey || e.metaKey) {
return // prevent custom shortcuts from interfering with system shortcuts
- }
- if (document.activeElement.type && document.activeElement.type === "text") {
+ } else if (document.activeElement.type && document.activeElement.type === "text") {
return // Prevent shortcuts from interfering with input fields
}
if (e.key === "/") {
@@ -77,7 +77,6 @@ const keydown = (e) => {
input_search.focus()
}
}
-
diff --git a/svelte/src/filesystem/FSNavigator.ts b/svelte/src/filesystem/FSNavigator.ts
index dcef638..7aa1b16 100644
--- a/svelte/src/filesystem/FSNavigator.ts
+++ b/svelte/src/filesystem/FSNavigator.ts
@@ -28,11 +28,11 @@ export class FSNavigator {
// Instead of reloading the page we use the navigator to navigate to the
// new page
if (history_enabled) {
- window.onpopstate = () => {
+ window.addEventListener("popstate", () => {
// Get the part of the URL after the fs root and navigate to it
const path = document.location.pathname.replace("/d/", "")
this.navigate(decodeURIComponent(path), false)
- }
+ })
}
}
@@ -104,7 +104,7 @@ export class FSNavigator {
// greeted to a 404 page when refreshing after renaming a file
if (this.history_enabled) {
window.document.title = node.path[node.base_index].name + " ~ pixeldrain"
- const url = "/d" + fs_encode_path(node.path[node.base_index].path)
+ const url = "/d" + fs_encode_path(node.path[node.base_index].path) + window.location.hash
if (push_history) {
window.history.pushState({}, window.document.title, url)
} else {
diff --git a/svelte/src/filesystem/Filesystem.svelte b/svelte/src/filesystem/Filesystem.svelte
index a25dbe1..1e64e52 100644
--- a/svelte/src/filesystem/Filesystem.svelte
+++ b/svelte/src/filesystem/Filesystem.svelte
@@ -6,7 +6,6 @@ import Toolbar from './Toolbar.svelte';
import Breadcrumbs from './Breadcrumbs.svelte';
import DetailsWindow from './DetailsWindow.svelte';
import FilePreview from './viewers/FilePreview.svelte';
-import SearchView from './SearchView.svelte';
import FSUploadWidget from './upload_widget/FSUploadWidget.svelte';
import { fs_path_url } from './FilesystemAPI';
import Menu from './Menu.svelte';
@@ -24,7 +23,6 @@ let download_frame
let details_visible = false
let edit_window
let edit_visible = false
-let view = "file"
const loading = writable(true)
const nav = new FSNavigator(true)
@@ -75,10 +73,6 @@ const keydown = e => {
case "r":
nav.shuffle = !nav.shuffle
break;
- case "/":
- case "f":
- search()
- break
case "a":
case "ArrowLeft":
nav.open_sibling(-1)
@@ -126,21 +120,6 @@ const download = () => {
download_frame.src = fs_path_url(nav.base.path) + "?bulk_download"
}
}
-
-const search = async () => {
- if (view === "search") {
- view = "file"
- return
- }
-
- // If we are not currently in a directory, then we navigate up to the parent
- // directory
- if (nav.base.type !== "dir") {
- await nav.navigate_up()
- }
-
- view = "search"
-}
@@ -159,24 +138,18 @@ const search = async () => {
bind:details_visible={details_visible}
edit_window={edit_window}
bind:edit_visible={edit_visible}
- bind:view={view}
on:download={download}
- on:search={search}
/>
- {#if view === "file"}
- nav.open_sibling(e.detail)}
- on:download={download}
- />
- {:else if view === "search"}
- {view = "file"}} />
- {/if}
+ nav.open_sibling(e.detail)}
+ on:download={download}
+ />
@@ -215,13 +188,13 @@ const search = async () => {