Enable searching in all directories

This commit is contained in:
2024-11-14 21:46:42 +01:00
parent e293c875b5
commit 5c4255dbbf
2 changed files with 7 additions and 5 deletions

View File

@@ -260,10 +260,7 @@ onMount(() => {
> >
<div class="width_container"> <div class="width_container">
{#if mode === "viewing"} {#if mode === "viewing"}
<!-- Search only works in the user's home directory --> <SearchBar nav={nav}/>
{#if $nav.path[0] && $nav.path[0].id === "me"}
<SearchBar nav={nav}/>
{/if}
<div class="toolbar"> <div class="toolbar">
<button on:click={navigate_back} title="Back"> <button on:click={navigate_back} title="Back">

View File

@@ -97,7 +97,6 @@ const input_keydown = e => {
const input_keyup = e => { const input_keyup = e => {
if (e.key === "Escape") { if (e.key === "Escape") {
clear_search(true) clear_search(true)
e.preventDefault()
} else if (e.key === "ArrowUp") { } else if (e.key === "ArrowUp") {
if (selected_result > 0) { if (selected_result > 0) {
selected_result-- selected_result--
@@ -170,6 +169,12 @@ const window_keydown = (e) => {
on:keydown={input_keydown} on:keydown={input_keydown}
on:keyup={input_keyup} on:keyup={input_keyup}
/> />
{#if search_term !== ""}
<!-- Button needs to be of button type in order to not submit the form -->
<button on:click={clear_search} type="button">
<i class="icon">close</i>
</button>
{/if}
</form> </form>
<div class="results"> <div class="results">