Fix vault overview

This commit is contained in:
Lost Paul 2023-08-12 23:25:40 +02:00
parent 0f42669043
commit d57d5e983d
2 changed files with 6 additions and 3 deletions

View file

@ -1,7 +1,7 @@
{
"id": "folder-notes",
"name": "Folder notes",
"version": "1.5.5",
"version": "1.5.6",
"minAppVersion": "0.15.0",
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
"author": "Lost Paul",

View file

@ -68,7 +68,7 @@ export class FolderOverview {
let files: TAbstractFile[] = [];
const sourceFile = plugin.app.vault.getAbstractFileByPath(ctx.sourcePath);
if (!sourceFile) return;
const sourceFolderPath = this.yaml.folderPath || plugin.getFolderPathFromString(ctx.sourcePath);
let sourceFolderPath = this.yaml.folderPath || plugin.getFolderPathFromString(ctx.sourcePath);
let sourceFolder: TFolder | undefined;
if (sourceFolderPath !== '/') {
if (this.yaml.folderPath === '') {
@ -86,7 +86,10 @@ export class FolderOverview {
titleEl.innerText = this.yaml.title.replace('{{folderName}}', '');
}
}
if (!sourceFolder && sourceFolderPath !== '/') { return new Notice('Couldn\'t find the folder'); }
if (!sourceFolder && (sourceFolderPath !== '/' && sourceFolderPath !== '')) { return new Notice('Couldn\'t find the folder'); }
if (!sourceFolder && sourceFolderPath == '') {
sourceFolderPath = '/';
}
if (sourceFolderPath == '/') {
const rootFiles: TAbstractFile[] = [];
plugin.app.vault.getAllLoadedFiles().filter(f => f.parent?.path === '/').forEach((file) => {