Small rework
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
import { cacheManager } from 'src/cache-manager'
|
||||
import { settings, showExcerpt } from 'src/settings'
|
||||
import type { ResultNote } from '../globals'
|
||||
import * as Search from '../search'
|
||||
import { highlighter, makeExcerpt, stringsToRegex } from '../utils'
|
||||
import ResultItemContainer from './ResultItemContainer.svelte'
|
||||
|
||||
@@ -10,7 +9,6 @@
|
||||
export let note: ResultNote
|
||||
|
||||
$: reg = stringsToRegex(note.foundWords)
|
||||
$: matches = Search.getMatches(note.content, reg)
|
||||
$: cleanedContent = makeExcerpt(note.content, note.matches[0]?.offset ?? -1)
|
||||
$: glyph = cacheManager.getNoteFromMemCache(note.path)?.doesNotExist
|
||||
$: title = settings.showShortName ? note.basename : note.path
|
||||
@@ -27,9 +25,9 @@
|
||||
{@html title.replace(reg, highlighter)}
|
||||
</span>
|
||||
|
||||
{#if matches.length > 0}
|
||||
{#if note.matches.length > 0}
|
||||
<span class="omnisearch-result__counter">
|
||||
{matches.length} {matches.length > 1 ? 'matches' : 'match'}
|
||||
{note.matches.length} {note.matches.length > 1 ? 'matches' : 'match'}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user