File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -178,17 +178,23 @@ export default class CustomSortPlugin
178178
179179 checkFileExplorerIsAvailableAndPatchable ( logWarning : boolean = true ) : FileExplorerView | undefined {
180180 let fileExplorerView : FileExplorerView | undefined = this . getFileExplorer ( )
181- if ( fileExplorerView
182- && typeof fileExplorerView . createFolderDom === 'function'
183- && typeof fileExplorerView . requestSort === 'function' ) {
184- return fileExplorerView
185- } else {
186- // Various scenarios when File Explorer was turned off (e.g. by some other plugin)
187- if ( logWarning ) {
188- this . logWarningFileExplorerNotAvailable ( )
181+ if ( fileExplorerView && typeof fileExplorerView . requestSort === 'function' ) {
182+ // The plugin integration points changed with Obsidian 1.6.0 hence the patchability-check should also be Obsidian version aware
183+ if ( requireApiVersion && requireApiVersion ( "1.6.0" ) ) {
184+ if ( typeof fileExplorerView . getSortedFolderItems === 'function' ) {
185+ return fileExplorerView
186+ }
187+ } else { // Obsidian versions prior to 1.6.0
188+ if ( typeof fileExplorerView . createFolderDom === 'function' ) {
189+ return fileExplorerView
190+ }
189191 }
190- return undefined
191192 }
193+ // Various scenarios when File Explorer was turned off (e.g. by some other plugin)
194+ if ( logWarning ) {
195+ this . logWarningFileExplorerNotAvailable ( )
196+ }
197+ return undefined
192198 }
193199
194200 logWarningFileExplorerNotAvailable ( ) {
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ declare module 'obsidian' {
5151
5252 export interface FileExplorerView extends View {
5353 createFolderDom ( folder : TFolder ) : FileExplorerFolder ;
54+ getSortedFolderItems ( sortedFolder : TFolder ) : any [ ] ;
5455
5556 requestSort ( ) : void ;
5657
You can’t perform that action at this time.
0 commit comments