From d662c0225b767a1d1fe9427164491b35088d35e3 Mon Sep 17 00:00:00 2001 From: SebastianMC <23032356+SebastianMC@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:04:22 +0200 Subject: [PATCH 1/2] Version bump for 1.9.0 release --- manifest.json | 2 +- package.json | 2 +- versions.json | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 066e6ca..18e4ed6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "custom-sort", "name": "Custom File Explorer sorting", - "version": "1.8.2", + "version": "1.9.0", "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 742ccd3..cb535ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-custom-sort", - "version": "1.8.2", + "version": "1.9.0", "description": "Custom Sort plugin for Obsidian (https://obsidian.md)", "main": "main.js", "scripts": { diff --git a/versions.json b/versions.json index 3ec6b34..986ab43 100644 --- a/versions.json +++ b/versions.json @@ -28,5 +28,6 @@ "1.7.0": "0.15.0", "1.7.1": "0.15.0", "1.7.2": "0.15.0", - "1.8.2": "0.15.0" + "1.8.2": "0.15.0", + "1.9.0": "0.15.0" } From 23b50da6cf92bb1865d79d6ca0569884d8aa96cd Mon Sep 17 00:00:00 2001 From: SebastianMC <23032356+SebastianMC@users.noreply.github.com> Date: Fri, 29 Sep 2023 22:12:49 +0200 Subject: [PATCH 2/2] Bugfix for integration with other plugins. Version bump for 1.9.2 release --- manifest.json | 2 +- package.json | 2 +- src/main.ts | 18 ++++++++++++++++-- versions.json | 4 +++- 4 files changed, 21 insertions(+), 5 deletions(-) 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" }