small fixes

This commit is contained in:
Simon Cambier
2024-10-26 11:07:21 +02:00
parent ec82bd29fa
commit efd99b67a0
3 changed files with 11 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
import ResultItemContainer from './ResultItemContainer.svelte' import ResultItemContainer from './ResultItemContainer.svelte'
import type OmnisearchPlugin from '../main' import type OmnisearchPlugin from '../main'
import { setIcon, TFile } from 'obsidian' import { setIcon, TFile } from 'obsidian'
import { onMount, SvelteComponent } from 'svelte' import { onMount } from 'svelte'
// Import icon utility functions // Import icon utility functions
import { import {
@@ -165,7 +165,8 @@
{:else} {:else}
<!-- File Icon --> <!-- File Icon -->
{#if fileIconSVG} {#if fileIconSVG}
<span class="omnisearch-result__icon" use:renderSVG="{fileIconSVG}"></span> <span class="omnisearch-result__icon" use:renderSVG="{fileIconSVG}"
></span>
{/if} {/if}
{/if} {/if}
<span> <span>
@@ -191,7 +192,8 @@
<div class="omnisearch-result__folder-path"> <div class="omnisearch-result__folder-path">
<!-- Folder Icon --> <!-- Folder Icon -->
{#if folderIconSVG} {#if folderIconSVG}
<span class="omnisearch-result__icon" use:renderSVG="{folderIconSVG}"></span> <span class="omnisearch-result__icon" use:renderSVG="{folderIconSVG}"
></span>
{/if} {/if}
<span> <span>
{@html plugin.textProcessor.highlightText(notePath, matchesNotePath)} {@html plugin.textProcessor.highlightText(notePath, matchesNotePath)}

View File

@@ -29,7 +29,7 @@ export class EmbedsRepository {
this.embeds.delete(oldPath) this.embeds.delete(oldPath)
} }
// If the file is a note referencing other files // If the file is a note referencing other files
this.embeds.forEach((referencedBy, key) => { this.embeds.forEach((referencedBy, _key) => {
if (referencedBy.has(oldPath)) { if (referencedBy.has(oldPath)) {
referencedBy.delete(oldPath) referencedBy.delete(oldPath)
referencedBy.add(newPath) referencedBy.add(newPath)
@@ -38,7 +38,7 @@ export class EmbedsRepository {
} }
public refreshEmbedsForNote(filePath: string): void { public refreshEmbedsForNote(filePath: string): void {
this.embeds.forEach((referencedBy, key) => { this.embeds.forEach((referencedBy, _key) => {
if (referencedBy.has(filePath)) { if (referencedBy.has(filePath)) {
referencedBy.delete(filePath) referencedBy.delete(filePath)
} }

View File

@@ -1,4 +1,4 @@
import { TFile, getIcon, normalizePath } from 'obsidian' import { getIcon, normalizePath } from 'obsidian'
import type OmnisearchPlugin from '../main' import type OmnisearchPlugin from '../main'
import { import {
isFileImage, isFileImage,
@@ -134,7 +134,9 @@ export async function loadIconSVG(
if (!prefix) { if (!prefix) {
// No prefix, assume it's an emoji or text // No prefix, assume it's an emoji or text
return `<span class="omnisearch-result__icon--emoji">${escapeHTML(name)}</span>` return `<span class="omnisearch-result__icon--emoji">${escapeHTML(
name
)}</span>`
} }
const iconPackName = prefixToIconPack[prefix] const iconPackName = prefixToIconPack[prefix]