Fixed layout, removed agressive highlighter and some console.logs
This commit is contained in:
@@ -24,3 +24,6 @@
|
|||||||
|
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.omnisearch-highlight {
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ $: {
|
|||||||
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(groups)
|
||||||
console.log(groupedOffsets)
|
// console.log(groupedOffsets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,7 @@ import CmpInput from "./CmpInput.svelte"
|
|||||||
import CmpNoteResult from "./CmpNoteResult.svelte"
|
import CmpNoteResult from "./CmpNoteResult.svelte"
|
||||||
import type { ResultNote } from "./globals"
|
import type { ResultNote } from "./globals"
|
||||||
import { openNote } from "./notes"
|
import { openNote } from "./notes"
|
||||||
import {
|
import { modal, plugin, resultNotes, searchQuery, selectedNote } from "./stores"
|
||||||
modal,
|
|
||||||
plugin,
|
|
||||||
resultNotes,
|
|
||||||
searchQuery,
|
|
||||||
selectedNote,
|
|
||||||
} from "./stores"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function createOrOpenNote(item: ResultNote): Promise<void> {
|
async function createOrOpenNote(item: ResultNote): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@@ -60,7 +52,8 @@ function onInputShiftEnter(event: CustomEvent<ResultNote>): void {
|
|||||||
<CmpNoteResult selected={result === $selectedNote} note={result} />
|
<CmpNoteResult selected={result === $selectedNote} note={result} />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instructions">
|
</div>
|
||||||
|
<div class="prompt-instructions">
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">↑↓</span><span>to navigate</span>
|
<span class="prompt-instruction-command">↑↓</span><span>to navigate</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -78,5 +71,4 @@ function onInputShiftEnter(event: CustomEvent<ResultNote>): void {
|
|||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">esc</span><span>to dismiss</span>
|
<span class="prompt-instruction-command">esc</span><span>to dismiss</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ export const regexYaml = /^---\s*\n(.*?)\n?^---\s?/ms
|
|||||||
export const excerptBefore = 100
|
export const excerptBefore = 100
|
||||||
export const excerptAfter = 180
|
export const excerptAfter = 180
|
||||||
|
|
||||||
|
export const highlightClass = 'suggestion-highlight omnisearch-highlight'
|
||||||
|
|
||||||
export type SearchNote = {
|
export type SearchNote = {
|
||||||
path: string
|
path: string
|
||||||
basename: string
|
basename: string
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ function subscribeToQuery(): void {
|
|||||||
? getSuggestions(q, { singleFile: get(singleFileSearch) })
|
? getSuggestions(q, { singleFile: get(singleFileSearch) })
|
||||||
: getSuggestions(q)
|
: getSuggestions(q)
|
||||||
|
|
||||||
console.log('Search results')
|
// console.log('Search results')
|
||||||
console.log(results)
|
// console.log(results)
|
||||||
|
|
||||||
// Save the results in the store
|
// Save the results in the store
|
||||||
resultNotes.set(results)
|
resultNotes.set(results)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { CachedMetadata } from 'obsidian'
|
import type { CachedMetadata } from 'obsidian'
|
||||||
import {
|
import {
|
||||||
|
highlightClass,
|
||||||
isSearchMatch,
|
isSearchMatch,
|
||||||
regexLineSplit,
|
regexLineSplit,
|
||||||
regexYaml,
|
regexYaml,
|
||||||
@@ -7,7 +8,7 @@ import {
|
|||||||
import type { SearchMatch } from './globals'
|
import type { SearchMatch } from './globals'
|
||||||
|
|
||||||
export function highlighter(str: string): string {
|
export function highlighter(str: string): string {
|
||||||
return '<span class="search-result-file-matched-text">' + str + '</span>'
|
return `<span class="${highlightClass}">${str}</span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function escapeHTML(html: string): string {
|
export function escapeHTML(html: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user