Fixed empty search input when going from InFile to Vault

This commit is contained in:
Simon Cambier
2022-10-23 09:16:27 +02:00
parent 13cd3a7bd7
commit 62b7c7a45c
3 changed files with 5 additions and 6 deletions

View File

@@ -18,6 +18,7 @@
} }
async function selectInput() { async function selectInput() {
await tick()
elInput.focus() elInput.focus()
await tick() await tick()
elInput.select() elInput.select()

View File

@@ -62,8 +62,6 @@
groupedOffsets = groups.map(group => groupedOffsets = groups.map(group =>
Math.round((group.first()!.offset + group.last()!.offset) / 2) Math.round((group.first()!.offset + group.last()!.offset) / 2)
) )
// console.log(groups)
// console.log(groupedOffsets)
} }
} }
@@ -145,7 +143,7 @@
<InputSearch <InputSearch
on:input="{e => (searchQuery = e.detail)}" on:input="{e => (searchQuery = e.detail)}"
placeholder="Omnisearch - File" placeholder="Omnisearch - File"
value="{searchQuery}"/> initialValue="{searchQuery}"/>
<ModalContainer> <ModalContainer>
{#if groupedOffsets.length && note} {#if groupedOffsets.length && note}

View File

@@ -12,7 +12,7 @@
import { Query } from 'src/search/query' import { Query } from 'src/search/query'
import { settings } from '../settings' import { settings } from '../settings'
import * as NotesIndex from '../notes-index' import * as NotesIndex from '../notes-index'
import { cacheManager } from "../cache-manager" import { cacheManager } from '../cache-manager'
export let modal: OmnisearchVaultModal export let modal: OmnisearchVaultModal
let selectedIndex = 0 let selectedIndex = 0
@@ -31,8 +31,6 @@
} }
onMount(async () => { onMount(async () => {
await NotesIndex.refreshIndex()
previousQuery = (await cacheManager.getSearchHistory())[historySearchIndex]
eventBus.enable('vault') eventBus.enable('vault')
eventBus.on('vault', 'enter', openNoteAndCloseModal) eventBus.on('vault', 'enter', openNoteAndCloseModal)
eventBus.on('vault', 'create-note', createNoteAndCloseModal) eventBus.on('vault', 'create-note', createNoteAndCloseModal)
@@ -43,6 +41,8 @@
eventBus.on('vault', 'arrow-down', () => moveIndex(1)) eventBus.on('vault', 'arrow-down', () => moveIndex(1))
eventBus.on('vault', 'prev-search-history', prevSearchHistory) eventBus.on('vault', 'prev-search-history', prevSearchHistory)
eventBus.on('vault', 'next-search-history', nextSearchHistory) eventBus.on('vault', 'next-search-history', nextSearchHistory)
await NotesIndex.refreshIndex()
previousQuery = (await cacheManager.getSearchHistory())[0]
}) })
onDestroy(() => { onDestroy(() => {