Show "dashboard" icon for excalidraw files
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
|||||||
getAliasesFromMetadata,
|
getAliasesFromMetadata,
|
||||||
getTagsFromMetadata,
|
getTagsFromMetadata,
|
||||||
isFileCanvas,
|
isFileCanvas,
|
||||||
isFileFromDataloomPlugin,
|
isFileFromDataloom,
|
||||||
isFileImage,
|
isFileImage,
|
||||||
isFileOffice,
|
isFileOffice,
|
||||||
isFilePDF,
|
isFilePDF,
|
||||||
@@ -135,7 +135,7 @@ export class CacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ** Dataloom plugin **
|
// ** Dataloom plugin **
|
||||||
else if (isFileFromDataloomPlugin(path)) {
|
else if (isFileFromDataloom(path)) {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(await app.vault.cachedRead(file))
|
const data = JSON.parse(await app.vault.cachedRead(file))
|
||||||
// data is a json object, we recursively iterate the keys
|
// data is a json object, we recursively iterate the keys
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import type { ResultNote } from '../globals'
|
import type { ResultNote } from '../globals'
|
||||||
import {
|
import {
|
||||||
getExtension,
|
getExtension,
|
||||||
isFileCanvas,
|
isFileCanvas, isFileExcalidraw,
|
||||||
isFileImage,
|
isFileImage,
|
||||||
isFilePDF,
|
isFilePDF,
|
||||||
pathWithoutFilename,
|
pathWithoutFilename,
|
||||||
@@ -44,11 +44,18 @@
|
|||||||
setIcon(elFolderPathIcon, 'folder-open')
|
setIcon(elFolderPathIcon, 'folder-open')
|
||||||
}
|
}
|
||||||
if (elFilePathIcon) {
|
if (elFilePathIcon) {
|
||||||
if (isFileImage(note.path)) setIcon(elFilePathIcon, 'image')
|
if (isFileImage(note.path)) {
|
||||||
else if (isFilePDF(note.path)) setIcon(elFilePathIcon, 'file-text')
|
setIcon(elFilePathIcon, 'image')
|
||||||
else if (isFileCanvas(note.path))
|
}
|
||||||
|
else if (isFilePDF(note.path)) {
|
||||||
|
setIcon(elFilePathIcon, 'file-text')
|
||||||
|
}
|
||||||
|
else if (isFileCanvas(note.path) || isFileExcalidraw(note.path)) {
|
||||||
setIcon(elFilePathIcon, 'layout-dashboard')
|
setIcon(elFilePathIcon, 'layout-dashboard')
|
||||||
else setIcon(elFilePathIcon, 'file')
|
}
|
||||||
|
else {
|
||||||
|
setIcon(elFilePathIcon, 'file')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { removeAnchors } from './tools/notes'
|
|||||||
import type { IndexedDocument } from './globals'
|
import type { IndexedDocument } from './globals'
|
||||||
import {
|
import {
|
||||||
isFileCanvas,
|
isFileCanvas,
|
||||||
isFileFromDataloomPlugin,
|
isFileFromDataloom,
|
||||||
isFileImage,
|
isFileImage,
|
||||||
isFilePDF,
|
isFilePDF,
|
||||||
logDebug,
|
logDebug,
|
||||||
@@ -49,7 +49,7 @@ export class NotesIndexer {
|
|||||||
return (
|
return (
|
||||||
this.isFilePlaintext(path) ||
|
this.isFilePlaintext(path) ||
|
||||||
isFileCanvas(path) ||
|
isFileCanvas(path) ||
|
||||||
isFileFromDataloomPlugin(path) ||
|
isFileFromDataloom(path) ||
|
||||||
(canIndexPDF && isFilePDF(path)) ||
|
(canIndexPDF && isFilePDF(path)) ||
|
||||||
(canIndexImages && isFileImage(path))
|
(canIndexImages && isFileImage(path))
|
||||||
)
|
)
|
||||||
@@ -60,7 +60,7 @@ export class NotesIndexer {
|
|||||||
this.canIndexUnsupportedFiles() ||
|
this.canIndexUnsupportedFiles() ||
|
||||||
this.isFilePlaintext(path) ||
|
this.isFilePlaintext(path) ||
|
||||||
isFileCanvas(path) ||
|
isFileCanvas(path) ||
|
||||||
isFileFromDataloomPlugin(path)
|
isFileFromDataloom(path)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,11 @@ export function isFileCanvas(path: string): boolean {
|
|||||||
return path.endsWith('.canvas')
|
return path.endsWith('.canvas')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFileFromDataloomPlugin(path: string): boolean {
|
export function isFileExcalidraw(path: string): boolean {
|
||||||
|
return path.endsWith('.excalidraw')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isFileFromDataloom(path: string): boolean {
|
||||||
return path.endsWith('.loom')
|
return path.endsWith('.loom')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user