@@ -17,7 +17,8 @@ import {
1717} from 'obsidian' ;
1818import { around } from 'monkey-around' ;
1919import {
20- folderSort
20+ folderSort ,
21+ ProcessingContext ,
2122} from './custom-sort/custom-sort' ;
2223import { SortingSpecProcessor , SortSpecsCollection } from './custom-sort/sorting-spec-processor' ;
2324import { CustomSortOrder , CustomSortSpec } from './custom-sort/custom-sort-types' ;
@@ -31,7 +32,9 @@ import {
3132 ICON_SORT_SUSPENDED_GENERAL_ERROR ,
3233 ICON_SORT_SUSPENDED_SYNTAX_ERROR
3334} from "./custom-sort/icons" ;
35+ import { getStarredPlugin } from "./utils/StarredPluginSignature" ;
3436
37+ import { getIconFolderPlugin } from "./utils/ObsidianIconFolderPluginSignature" ;
3538import { lastPathComponent } from "./utils/utils" ;
3639
3740interface CustomSortPluginSettings {
@@ -325,6 +328,17 @@ export default class CustomSortPlugin extends Plugin {
325328 return sortSpec
326329 }
327330
331+ createProcessingContextForSorting ( ) : ProcessingContext {
332+ const ctx : ProcessingContext = {
333+ _mCache : app . metadataCache ,
334+ starredPluginInstance : getStarredPlugin ( ) ,
335+
336+ iconFolderPluginInstance : getIconFolderPlugin ( ) ,
337+ plugin : this
338+ }
339+ return ctx
340+ }
341+
328342 // For the idea of monkey-patching credits go to https://github.com/nothingislost/obsidian-bartender
329343 patchFileExplorerFolder ( patchableFileExplorer ?: FileExplorerView ) : boolean {
330344 let plugin = this ;
@@ -352,7 +366,7 @@ export default class CustomSortPlugin extends Plugin {
352366 let sortSpec : CustomSortSpec | null | undefined = plugin . determineSortSpecForFolder ( folder . path , folder . name )
353367
354368 if ( sortSpec ) {
355- return folderSort . call ( this , sortSpec , ... args ) ;
369+ return folderSort . call ( this , sortSpec , plugin . createProcessingContextForSorting ( ) ) ;
356370 } else {
357371 return old . call ( this , ...args ) ;
358372 }
0 commit comments