Skip to content

Commit 23b50da

Browse files
committed
Bugfix for integration with other plugins.
Version bump for 1.9.2 release
1 parent d662c02 commit 23b50da

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "custom-sort",
33
"name": "Custom File Explorer sorting",
4-
"version": "1.9.0",
4+
"version": "1.9.2",
55
"minAppVersion": "0.15.0",
66
"description": "Allows for manual and automatic, config-driven reordering and sorting of files and folders in File Explorer",
77
"author": "SebastianMC",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-custom-sort",
3-
"version": "1.9.0",
3+
"version": "1.9.2",
44
"description": "Custom Sort plugin for Obsidian (https://obsidian.md)",
55
"main": "main.js",
66
"scripts": {

src/main.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import {
1717
} from 'obsidian';
1818
import {around} from 'monkey-around';
1919
import {
20-
folderSort
20+
folderSort,
21+
ProcessingContext,
2122
} from './custom-sort/custom-sort';
2223
import {SortingSpecProcessor, SortSpecsCollection} from './custom-sort/sorting-spec-processor';
2324
import {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";
3538
import {lastPathComponent} from "./utils/utils";
3639

3740
interface 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
}

versions.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@
2929
"1.7.1": "0.15.0",
3030
"1.7.2": "0.15.0",
3131
"1.8.2": "0.15.0",
32-
"1.9.0": "0.15.0"
32+
"1.9.0": "0.15.0",
33+
"1.9.1": "0.15.0",
34+
"1.9.2": "0.15.0"
3335
}

0 commit comments

Comments
 (0)