From 238c027903e2d7f26e4ba09420febe0390754a09 Mon Sep 17 00:00:00 2001 From: SebastianMC <23032356+SebastianMC@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:34:27 +0100 Subject: [PATCH] Bugfix for #131 Obsidian introduced breaking changes around File Explorer JS structure which prevented this custom-sort plugin from working. --- src/custom-sort/custom-sort.ts | 4 ++-- src/main.ts | 2 +- src/types/types.d.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/custom-sort/custom-sort.ts b/src/custom-sort/custom-sort.ts index d088bde74..abae5c43d 100644 --- a/src/custom-sort/custom-sort.ts +++ b/src/custom-sort/custom-sort.ts @@ -1,4 +1,5 @@ import { + FileExplorerView, FrontMatterCache, MetadataCache, Plugin, @@ -684,8 +685,7 @@ export const determineBookmarksOrderIfNeeded = (folderItems: Array Object.assign({} as CustomSortGroup, group)) diff --git a/src/main.ts b/src/main.ts index fcdbd88d0..53b07d003 100644 --- a/src/main.ts +++ b/src/main.ts @@ -622,7 +622,7 @@ export default class CustomSortPlugin extends Plugin { } if (sortSpec) { - return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting(has)); + return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting(has), patchableFileExplorer); } else { return old.call(this, ...args); } diff --git a/src/types/types.d.ts b/src/types/types.d.ts index 1e96a5c2c..4a0b01ce4 100644 --- a/src/types/types.d.ts +++ b/src/types/types.d.ts @@ -51,7 +51,7 @@ declare module 'obsidian' { export interface FileExplorerView extends View { createFolderDom(folder: TFolder): FileExplorerFolder; - + fileItems: any; requestSort(): void; sortOrder: string