Fixed icons bug
This commit is contained in:
+12
-12
@@ -1,20 +1,20 @@
|
|||||||
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 (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 : ''
|
||||||
|
|||||||
Reference in New Issue
Block a user