From 53b5895e81329484acc6f49e3287e6e01e5e192c Mon Sep 17 00:00:00 2001 From: SebastianMC <23032356+SebastianMC@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:24:04 +0100 Subject: [PATCH] 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 --- README.md | 4 ---- manifest.json | 2 +- package.json | 2 +- src/custom-sort/custom-sort.ts | 6 +++--- versions.json | 3 ++- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f105a460..e823feb6 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/manifest.json b/manifest.json index 9583bb9e..dfc9e749 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/package.json b/package.json index fd99cd7d..edc42494 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/custom-sort/custom-sort.ts b/src/custom-sort/custom-sort.ts index d088bde7..976e834a 100644 --- a/src/custom-sort/custom-sort.ts +++ b/src/custom-sort/custom-sort.ts @@ -685,7 +685,7 @@ export const determineBookmarksOrderIfNeeded = (folderItems: Array 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); diff --git a/versions.json b/versions.json index aa25d45c..73efd7c6 100644 --- a/versions.json +++ b/versions.json @@ -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" }