Bugfix for #131
Obsidian introduced breaking changes around File Explorer JS structure which prevented this custom-sort plugin from working.
This commit is contained in:
parent
a2a808e78b
commit
238c027903
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
FileExplorerView,
|
||||
FrontMatterCache,
|
||||
MetadataCache,
|
||||
Plugin,
|
||||
|
@ -684,8 +685,7 @@ export const determineBookmarksOrderIfNeeded = (folderItems: Array<FolderItemFor
|
|||
})
|
||||
}
|
||||
|
||||
export const folderSort = function (sortingSpec: CustomSortSpec, ctx: ProcessingContext) {
|
||||
let fileExplorer = this.fileExplorer
|
||||
export const folderSort = function (sortingSpec: CustomSortSpec, ctx: ProcessingContext, fileExplorer: FileExplorerView) {
|
||||
|
||||
// shallow copy of groups and expand folder-specific macros on them
|
||||
sortingSpec.groupsShadow = sortingSpec.groups?.map((group) => Object.assign({} as CustomSortGroup, group))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ declare module 'obsidian' {
|
|||
|
||||
export interface FileExplorerView extends View {
|
||||
createFolderDom(folder: TFolder): FileExplorerFolder;
|
||||
|
||||
fileItems: any;
|
||||
requestSort(): void;
|
||||
|
||||
sortOrder: string
|
||||
|
|
Loading…
Reference in New Issue