In-file search ok

This commit is contained in:
Simon Cambier
2022-04-18 22:01:15 +02:00
parent 47b30b5c62
commit f6c3f9b580
8 changed files with 133 additions and 138 deletions

View File

@@ -7,11 +7,9 @@ import {
plugin,
resultNotes,
searchQuery,
selectedNote,
} from './stores'
import { get } from 'svelte/store'
import { extractHeadingsFromCache, stringsToRegex, wait } from './utils'
import { tick } from 'svelte'
let minisearchInstance: MiniSearch<IndexedNote>
@@ -96,13 +94,6 @@ function subscribeToQuery(): void {
// Save the results in the store
resultNotes.set(results)
// Automatically select the first result
const firstResult = results[0]
if (firstResult) {
await tick()
selectedNote.set(firstResult)
}
}
}