diff --git a/svelte/src/filesystem/FilesystemAPI.ts b/svelte/src/filesystem/FilesystemAPI.ts index d43cc51..7b23053 100644 --- a/svelte/src/filesystem/FilesystemAPI.ts +++ b/svelte/src/filesystem/FilesystemAPI.ts @@ -260,6 +260,8 @@ export const fs_node_type = (node: FSNode) => { return "pdf" } else if ( node.file_type === "application/json" || + node.file_type === "application/x-yaml" || + node.file_type === "application/x-shellscript" || node.file_type.startsWith("text") ) { return "text" diff --git a/svelte/src/filesystem/filemanager/SearchBar.svelte b/svelte/src/filesystem/filemanager/SearchBar.svelte index bcf412d..4f08115 100644 --- a/svelte/src/filesystem/filemanager/SearchBar.svelte +++ b/svelte/src/filesystem/filemanager/SearchBar.svelte @@ -89,14 +89,15 @@ const clear_search = (blur) => { // Cursor navigation events can only be prevented with keydown. But we want to // use keyup for searching, so we use two listeners here -const keydown = e => { +const input_keydown = e => { if (e.key === "Escape" || e.key === "ArrowUp" || e.key === "ArrowDown") { e.preventDefault() } } -const keyup = e => { +const input_keyup = e => { if (e.key === "Escape") { clear_search(true) + e.preventDefault() } else if (e.key === "ArrowUp") { if (selected_result > 0) { selected_result-- @@ -123,6 +124,12 @@ const open_result = index => { } const window_keydown = (e) => { + if (e.ctrlKey || e.altKey || e.metaKey) { + return // prevent custom shortcuts from interfering with system shortcuts + } else if (document.activeElement.type && document.activeElement.type === "text") { + return // Prevent shortcuts from interfering with input fields + } + if (e.key === "Escape" && search_term !== "") { clear_search(true) e.preventDefault() @@ -160,12 +167,16 @@ const window_keydown = (e) => { placeholder="Type to search in {$nav.base.name}" style="width: 100%;" bind:value={search_term} - on:keydown={keydown} - on:keyup={keyup} + on:keydown={input_keydown} + on:keyup={input_keyup} />