Fixed icons bug
This commit is contained in:
		
							parent
							
								
									46a5d3d114
								
							
						
					
					
						commit
						282fd1be13
					
				| 
						 | 
				
			
			@ -1,20 +1,20 @@
 | 
			
		|||
import { getIcon } from 'obsidian'
 | 
			
		||||
import {
 | 
			
		||||
  isFileCanvas,
 | 
			
		||||
  isFileExcalidraw,
 | 
			
		||||
  isFileImage,
 | 
			
		||||
  isFilePDF
 | 
			
		||||
} from './utils'
 | 
			
		||||
import { isFileCanvas, isFileExcalidraw, isFileImage, isFilePDF } from './utils'
 | 
			
		||||
 | 
			
		||||
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 : ''
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user