diff --git a/manifest.json b/manifest.json index 18e4ed6..774524b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "custom-sort", "name": "Custom File Explorer sorting", - "version": "1.9.0", + "version": "1.9.2", "minAppVersion": "0.15.0", "description": "Allows for manual and automatic, config-driven reordering and sorting of files and folders in File Explorer", "author": "SebastianMC", diff --git a/package.json b/package.json index cb535ff..aee27ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-custom-sort", - "version": "1.9.0", + "version": "1.9.2", "description": "Custom Sort plugin for Obsidian (https://obsidian.md)", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 97b6b95..022f4d9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,7 +17,8 @@ import { } from 'obsidian'; import {around} from 'monkey-around'; import { - folderSort + folderSort, + ProcessingContext, } from './custom-sort/custom-sort'; import {SortingSpecProcessor, SortSpecsCollection} from './custom-sort/sorting-spec-processor'; import {CustomSortOrder, CustomSortSpec} from './custom-sort/custom-sort-types'; @@ -31,7 +32,9 @@ import { ICON_SORT_SUSPENDED_GENERAL_ERROR, ICON_SORT_SUSPENDED_SYNTAX_ERROR } from "./custom-sort/icons"; +import {getStarredPlugin} from "./utils/StarredPluginSignature"; +import {getIconFolderPlugin} from "./utils/ObsidianIconFolderPluginSignature"; import {lastPathComponent} from "./utils/utils"; interface CustomSortPluginSettings { @@ -325,6 +328,17 @@ export default class CustomSortPlugin extends Plugin { return sortSpec } + createProcessingContextForSorting(): ProcessingContext { + const ctx: ProcessingContext = { + _mCache: app.metadataCache, + starredPluginInstance: getStarredPlugin(), + + iconFolderPluginInstance: getIconFolderPlugin(), + plugin: this + } + return ctx + } + // For the idea of monkey-patching credits go to https://github.com/nothingislost/obsidian-bartender patchFileExplorerFolder(patchableFileExplorer?: FileExplorerView): boolean { let plugin = this; @@ -352,7 +366,7 @@ export default class CustomSortPlugin extends Plugin { let sortSpec: CustomSortSpec | null | undefined = plugin.determineSortSpecForFolder(folder.path, folder.name) if (sortSpec) { - return folderSort.call(this, sortSpec, ...args); + return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting()); } else { return old.call(this, ...args); } diff --git a/versions.json b/versions.json index 986ab43..fa1488d 100644 --- a/versions.json +++ b/versions.json @@ -29,5 +29,7 @@ "1.7.1": "0.15.0", "1.7.2": "0.15.0", "1.8.2": "0.15.0", - "1.9.0": "0.15.0" + "1.9.0": "0.15.0", + "1.9.1": "0.15.0", + "1.9.2": "0.15.0" }