Bugfix for #131
Obsidian introduced breaking changes around File Explorer JS structure which prevented this custom-sort plugin from working. - fix backward compatible with versions earlier that 1.5.4 - version bump before release
This commit is contained in:
parent
9f4008c2a2
commit
53b5895e81
|
@ -1,7 +1,3 @@
|
|||
| :exclamation: For users of Obsidian insider build versions (1.5.4 and up)|
|
||||
|----|
|
||||
| 1.5.4 insider build of Obsidian introduced breaking changes in JS code of File Explorer which prevents this custom-sort plugin from working. Please refrain from updating Obsidian until the code of custom-sort is updated. |
|
||||
|
||||
> > This is a simple version of README which highlights the **basic scenario and most commonly used feature**
|
||||
>
|
||||
> The [long and much more detailed advanced-README.md is here](https://github.com/SebastianMC/obsidian-custom-sort/blob/master/docs/advanced-README.md)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "custom-sort",
|
||||
"name": "Custom File Explorer sorting",
|
||||
"version": "2.1.5",
|
||||
"version": "2.1.7",
|
||||
"minAppVersion": "0.16.2",
|
||||
"description": "Allows for manual and automatic, config-driven reordering and sorting of files and folders in File Explorer",
|
||||
"author": "SebastianMC",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-custom-sort",
|
||||
"version": "2.1.5",
|
||||
"version": "2.1.7",
|
||||
"description": "Custom Sort plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -685,7 +685,7 @@ export const determineBookmarksOrderIfNeeded = (folderItems: Array<FolderItemFor
|
|||
}
|
||||
|
||||
export const folderSort = function (sortingSpec: CustomSortSpec, ctx: ProcessingContext) {
|
||||
let fileExplorer = this.fileExplorer
|
||||
let fileExplorerView = this.fileExplorer ?? this.view // this.view replaces the former since 1.5.4 insider build
|
||||
|
||||
// shallow copy of groups and expand folder-specific macros on them
|
||||
sortingSpec.groupsShadow = sortingSpec.groups?.map((group) => Object.assign({} as CustomSortGroup, group))
|
||||
|
@ -710,12 +710,12 @@ export const folderSort = function (sortingSpec: CustomSortSpec, ctx: Processing
|
|||
determineBookmarksOrderIfNeeded(folderItems, sortingSpec, ctx.bookmarksPluginInstance)
|
||||
}
|
||||
|
||||
const comparator: SorterFn = getComparator(sortingSpec, fileExplorer.sortOrder)
|
||||
const comparator: SorterFn = getComparator(sortingSpec, fileExplorerView.sortOrder)
|
||||
|
||||
folderItems.sort(comparator)
|
||||
|
||||
const items = folderItems
|
||||
.map((item: FolderItemForSorting) => fileExplorer.fileItems[item.path])
|
||||
.map((item: FolderItemForSorting) => fileExplorerView.fileItems[item.path])
|
||||
|
||||
if (requireApiVersion && requireApiVersion("0.15.0")) {
|
||||
this.vChildren.setChildren(items);
|
||||
|
|
|
@ -39,5 +39,6 @@
|
|||
"2.1.2": "0.16.2",
|
||||
"2.1.3": "0.16.2",
|
||||
"2.1.4": "0.16.2",
|
||||
"2.1.5": "0.16.2"
|
||||
"2.1.5": "0.16.2",
|
||||
"2.1.7": "0.16.2"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue