Skip to content

Get the sorted file list via JS API #167

Discussion options

You must be logged in to vote

Hi @garlicbreadcleric

the relevant API function has been already there, intentionally, yet not exposed as public.

Scan main.ts file of the plugin for member function orderedFolderItemsForBookmarking(...)

The function takes as parameter a TFolder object, works in the context of current state of Obsidian and the custom-sort plugin to determine the sorting for the folder (standard UI-selected or custom), performs the sorting and returns ordered list of TAbstractFile items (that means TFolder and TFile instances)

The result of the function is exactly the same order which user sees in the File Explorer for the supplied folder.
As simple as it sounds, there are the non-obvious things:

  • if the c…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@garlicbreadcleric
Comment options

@SebastianMC
Comment options

@garlicbreadcleric
Comment options

@garlicbreadcleric
Comment options

Answer selected by garlicbreadcleric
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants