From d12312a43befebe3ffadf1e25745242867611b25 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Thu, 10 Jul 2025 18:21:33 +0200 Subject: [PATCH] Fixed default folder icon --- src/components/ResultItemVault.svelte | 4 ++-- src/tools/icon-utils.ts | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/ResultItemVault.svelte b/src/components/ResultItemVault.svelte index fa9cbef..708772b 100644 --- a/src/components/ResultItemVault.svelte +++ b/src/components/ResultItemVault.svelte @@ -68,7 +68,7 @@ ) } else { // Fallback to default folder icon - folderIconSVG = getDefaultIconSVG('folder', plugin) + folderIconSVG = getDefaultIconSVG('folder') } // Load file icon @@ -82,7 +82,7 @@ ) } else { // Fallback to default icons based on file type - fileIconSVG = getDefaultIconSVG(note.path, plugin) + fileIconSVG = getDefaultIconSVG(note.path) } } diff --git a/src/tools/icon-utils.ts b/src/tools/icon-utils.ts index 82c619b..16182cf 100644 --- a/src/tools/icon-utils.ts +++ b/src/tools/icon-utils.ts @@ -172,18 +172,20 @@ export async function loadIconSVG( } } -export function getDefaultIconSVG( - notePath: string, - plugin: OmnisearchPlugin -): string { +export function getDefaultIconSVG(notePath: string): string { // Return SVG content for default icons based on file type let iconName = 'file' - if (isFileImage(notePath)) { - iconName = 'image' - } else if (isFilePDF(notePath)) { - iconName = 'file-text' - } else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) { - iconName = 'layout-dashboard' + + if (notePath === 'folder') { + iconName = 'folder' + } else { + if (isFileImage(notePath)) { + iconName = 'image' + } else if (isFilePDF(notePath)) { + iconName = 'file-text' + } else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) { + iconName = 'layout-dashboard' + } } const iconEl = getIcon(iconName) return iconEl ? iconEl.outerHTML : ''