|
1 | 1 | import { |
2 | 2 | FrontMatterCache, |
3 | 3 | MetadataCache, |
4 | | - Plugin, |
5 | | - requireApiVersion, |
6 | 4 | TAbstractFile, |
7 | 5 | TFile, |
8 | 6 | TFolder, |
9 | 7 | Vault |
10 | 8 | } from 'obsidian'; |
11 | | -import { |
12 | | - determineStarredStatusOf, |
13 | | - Starred_PluginInstance |
14 | | -} from '../utils/StarredPluginSignature'; |
15 | 9 | import { |
16 | 10 | determineIconOf, |
17 | 11 | ObsidianIconFolder_PluginInstance |
@@ -40,7 +34,6 @@ export interface ProcessingContext { |
40 | 34 | // For internal transient use |
41 | 35 | plugin?: CustomSortPluginAPI // to hand over the access to App instance to the sorting engine |
42 | 36 | _mCache?: MetadataCache |
43 | | - starredPluginInstance?: Starred_PluginInstance |
44 | 37 | bookmarksPluginInstance?: BookmarksPluginInterface, |
45 | 38 | iconFolderPluginInstance?: ObsidianIconFolder_PluginInstance |
46 | 39 | } |
@@ -495,14 +488,6 @@ export const determineSortingGroup = function (entry: TFile | TFolder, spec: Cus |
495 | 488 | } |
496 | 489 | } |
497 | 490 | break |
498 | | - case CustomSortGroupType.StarredOnly: |
499 | | - if (ctx?.starredPluginInstance) { |
500 | | - const starred: boolean = determineStarredStatusOf(entry, aFile, ctx.starredPluginInstance) |
501 | | - if (starred) { |
502 | | - determined = true |
503 | | - } |
504 | | - } |
505 | | - break |
506 | 491 | case CustomSortGroupType.BookmarkedOnly: |
507 | 492 | if (ctx?.bookmarksPluginInstance) { |
508 | 493 | const bookmarkOrder: number | undefined = ctx?.bookmarksPluginInstance.determineBookmarkOrder(entry.path) |
@@ -732,28 +717,8 @@ export const determineBookmarksOrderIfNeeded = (folderItems: Array<FolderItemFor |
732 | 717 | }) |
733 | 718 | } |
734 | 719 |
|
735 | | -// This function is a replacement for the Obsidian File Explorer function sort(...) up to Obsidian 1.6.0 |
736 | | -// when a major refactoring of sorting mechanics happened |
737 | | -export const folderSort_vUpTo_1_6_0 = function (sortingSpec: CustomSortSpec, ctx: ProcessingContext) { |
738 | | - |
739 | | - const fileExplorerView = this.fileExplorer ?? this.view // this.view replaces the former since 1.5.4 insider build |
740 | | - const folderUnderSort = this.file as TFolder |
741 | | - const sortOrder = this.sortOrder |
742 | | - const allFileItemsCollection = fileExplorerView.fileItems |
743 | | - |
744 | | - const items = folderSortCore(folderUnderSort, sortOrder, sortingSpec, allFileItemsCollection, ctx) |
745 | | - |
746 | | - if (requireApiVersion && requireApiVersion("0.15.0")) { |
747 | | - this.vChildren.setChildren(items); |
748 | | - } else { |
749 | | - this.children = items; |
750 | | - } |
751 | | -} |
752 | | - |
753 | | -// This function is a replacement for the Obsidian File Explorer function getSortedFolderItems(...) |
754 | | -// which first appeared in Obsidian 1.6.0 and simplified a bit the plugin integration point |
755 | | -export const getSortedFolderItems_vFrom_1_6_0 = function (sortedFolder: TFolder, sortingSpec: CustomSortSpec, ctx: ProcessingContext) { |
756 | | - const sortOrder = this.sortOrder |
| 720 | +export const getSortedFolderItems = function (sortedFolder: TFolder, sortingSpec: CustomSortSpec, ctx: ProcessingContext) { |
| 721 | + const sortOrder = this.sortOrder // this is bound to FileExplorer Obsidian component |
757 | 722 | const allFileItemsCollection = this.fileItems |
758 | 723 | return folderSortCore(sortedFolder, sortOrder, sortingSpec, allFileItemsCollection, ctx) |
759 | 724 | } |
|
0 commit comments