Fixed icons bug

This commit is contained in:
Simon Cambier 2025-06-25 21:49:52 +02:00
parent 46a5d3d114
commit 282fd1be13

View File

@ -1,14 +1,13 @@
import { getIcon } from 'obsidian' import { getIcon } from 'obsidian'
import { import { isFileCanvas, isFileExcalidraw, isFileImage, isFilePDF } from './utils'
isFileCanvas,
isFileExcalidraw,
isFileImage,
isFilePDF
} from './utils'
export function getDefaultIconSVG(notePath: string): string { export function getDefaultIconSVG(notePath: string): 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 (notePath === 'folder') {
iconName = 'folder'
} else {
if (isFileImage(notePath)) { if (isFileImage(notePath)) {
iconName = 'image' iconName = 'image'
} else if (isFilePDF(notePath)) { } else if (isFilePDF(notePath)) {
@ -16,6 +15,7 @@ export function getDefaultIconSVG(notePath: string): string {
} else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) { } else if (isFileCanvas(notePath) || isFileExcalidraw(notePath)) {
iconName = 'layout-dashboard' iconName = 'layout-dashboard'
} }
}
const iconEl = getIcon(iconName) const iconEl = getIcon(iconName)
return iconEl ? iconEl.outerHTML : '' return iconEl ? iconEl.outerHTML : ''
} }