Fixed default folder icon

This commit is contained in:
Simon Cambier
2025-07-10 18:21:33 +02:00
parent 38caacfa4f
commit d12312a43b
2 changed files with 14 additions and 12 deletions

View File

@@ -68,7 +68,7 @@
) )
} else { } else {
// Fallback to default folder icon // Fallback to default folder icon
folderIconSVG = getDefaultIconSVG('folder', plugin) folderIconSVG = getDefaultIconSVG('folder')
} }
// Load file icon // Load file icon
@@ -82,7 +82,7 @@
) )
} else { } else {
// Fallback to default icons based on file type // Fallback to default icons based on file type
fileIconSVG = getDefaultIconSVG(note.path, plugin) fileIconSVG = getDefaultIconSVG(note.path)
} }
} }

View File

@@ -172,18 +172,20 @@ export async function loadIconSVG(
} }
} }
export function getDefaultIconSVG( export function getDefaultIconSVG(notePath: string): string {
notePath: string,
plugin: OmnisearchPlugin
): string {
// Return SVG content for default icons based on file type // Return SVG content for default icons based on file type
let iconName = 'file' let iconName = 'file'
if (isFileImage(notePath)) {
iconName = 'image' if (notePath === 'folder') {
} else if (isFilePDF(notePath)) { iconName = 'folder'
iconName = 'file-text' } else {
} else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) { if (isFileImage(notePath)) {
iconName = 'layout-dashboard' iconName = 'image'
} else if (isFilePDF(notePath)) {
iconName = 'file-text'
} else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) {
iconName = 'layout-dashboard'
}
} }
const iconEl = getIcon(iconName) const iconEl = getIcon(iconName)
return iconEl ? iconEl.outerHTML : '' return iconEl ? iconEl.outerHTML : ''