Bugfix for integration with other plugins.
Version bump for 1.9.2 release
This commit is contained in:
parent
d662c0225b
commit
23b50da6cf
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "custom-sort",
|
"id": "custom-sort",
|
||||||
"name": "Custom File Explorer sorting",
|
"name": "Custom File Explorer sorting",
|
||||||
"version": "1.9.0",
|
"version": "1.9.2",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "Allows for manual and automatic, config-driven reordering and sorting of files and folders in File Explorer",
|
"description": "Allows for manual and automatic, config-driven reordering and sorting of files and folders in File Explorer",
|
||||||
"author": "SebastianMC",
|
"author": "SebastianMC",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "obsidian-custom-sort",
|
"name": "obsidian-custom-sort",
|
||||||
"version": "1.9.0",
|
"version": "1.9.2",
|
||||||
"description": "Custom Sort plugin for Obsidian (https://obsidian.md)",
|
"description": "Custom Sort plugin for Obsidian (https://obsidian.md)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
18
src/main.ts
18
src/main.ts
|
@ -17,7 +17,8 @@ import {
|
||||||
} from 'obsidian';
|
} from 'obsidian';
|
||||||
import {around} from 'monkey-around';
|
import {around} from 'monkey-around';
|
||||||
import {
|
import {
|
||||||
folderSort
|
folderSort,
|
||||||
|
ProcessingContext,
|
||||||
} from './custom-sort/custom-sort';
|
} from './custom-sort/custom-sort';
|
||||||
import {SortingSpecProcessor, SortSpecsCollection} from './custom-sort/sorting-spec-processor';
|
import {SortingSpecProcessor, SortSpecsCollection} from './custom-sort/sorting-spec-processor';
|
||||||
import {CustomSortOrder, CustomSortSpec} from './custom-sort/custom-sort-types';
|
import {CustomSortOrder, CustomSortSpec} from './custom-sort/custom-sort-types';
|
||||||
|
@ -31,7 +32,9 @@ import {
|
||||||
ICON_SORT_SUSPENDED_GENERAL_ERROR,
|
ICON_SORT_SUSPENDED_GENERAL_ERROR,
|
||||||
ICON_SORT_SUSPENDED_SYNTAX_ERROR
|
ICON_SORT_SUSPENDED_SYNTAX_ERROR
|
||||||
} from "./custom-sort/icons";
|
} from "./custom-sort/icons";
|
||||||
|
import {getStarredPlugin} from "./utils/StarredPluginSignature";
|
||||||
|
|
||||||
|
import {getIconFolderPlugin} from "./utils/ObsidianIconFolderPluginSignature";
|
||||||
import {lastPathComponent} from "./utils/utils";
|
import {lastPathComponent} from "./utils/utils";
|
||||||
|
|
||||||
interface CustomSortPluginSettings {
|
interface CustomSortPluginSettings {
|
||||||
|
@ -325,6 +328,17 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
return sortSpec
|
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
|
// For the idea of monkey-patching credits go to https://github.com/nothingislost/obsidian-bartender
|
||||||
patchFileExplorerFolder(patchableFileExplorer?: FileExplorerView): boolean {
|
patchFileExplorerFolder(patchableFileExplorer?: FileExplorerView): boolean {
|
||||||
let plugin = this;
|
let plugin = this;
|
||||||
|
@ -352,7 +366,7 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
let sortSpec: CustomSortSpec | null | undefined = plugin.determineSortSpecForFolder(folder.path, folder.name)
|
let sortSpec: CustomSortSpec | null | undefined = plugin.determineSortSpecForFolder(folder.path, folder.name)
|
||||||
|
|
||||||
if (sortSpec) {
|
if (sortSpec) {
|
||||||
return folderSort.call(this, sortSpec, ...args);
|
return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting());
|
||||||
} else {
|
} else {
|
||||||
return old.call(this, ...args);
|
return old.call(this, ...args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,7 @@
|
||||||
"1.7.1": "0.15.0",
|
"1.7.1": "0.15.0",
|
||||||
"1.7.2": "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"
|
"1.9.0": "0.15.0",
|
||||||
|
"1.9.1": "0.15.0",
|
||||||
|
"1.9.2": "0.15.0"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue