Document Explorer for Silverbullet

I know this, and currently I can’t get around it, because the DOM of the panel first must be created then the JS will apply the custom CSS to wrap it in a container and apply Drag&Resize logic to it. I know the brief flicker could be a little bothering, but that is currently we need to live with, unless someone could come up with a simple solution to this.

Can you please make a screenshot or can you detail what exactly is happening.
I’m not familiar with the Markmap plugin and how is this related to the document explorer.

MERRY CHRISTMAS EVERYONE :santa_claus::christmas_tree::dizzy:

[UPDATE & ChangeLog]

  • added List View
  • added :christmas_tree:Tree View
  • other minor tweaks
    image



2 Likes

Excellent!
And the drag-and-drop page path function is perfect.

Congratulations and thank you!

1 Like

With “MD” tag on the right, the left probably doesn’t need “.md” (Softly nitpicking -_-|)

from the tree-view

I know…I know…I messed up really bad :stuck_out_tongue:
it will be solved in the next release :wink:

Two problems encountered:

  • configuration parameters are not taken into account if placed in CONFIG. After two hours of testing, I can’t identify the origin of the problem. Temporary solution: place the config space-lua in Library/Mr-xRed/DocumentExplorer after defining the schema!

  • Systematic crash here (function renderTree):

    if not rel:find(part .. "/") then 
       current[part]._path = f.name 
    end

Erreur : Uncaught (in promise) Error: nothing to repeat

After commenting out the 3 lines, the tree appears but all the files are assimilated to a folder (icon, right click, etc.).

context : SB edge (local) under Firefox / W11

Thanks !

Finally installed this and wow. Very nice! Practically a treeview replacement! I also struggle with setting up config in CONFIG but I suspect this may have to do with load priorities? Haven’t looked into it yet.

1 Like

yes that definitely could be due to priority issues.
Try your config with : -- priority: 11
and in the next release i will reduce the priority of my space-lua to 0 so the default priority of the config doesn’t make issues.

1 Like

this happens when there is a priority mismatch between the lua and the config.
I reduced the Priority of the space-lua to 0, hopefully this will fix it.

This usually happens when a string contains a special character (like +, *, ?, or ( )) that the regex engine tries to interpret as a quantifier with nothing preceding it.

In your case, if a folder or file name has a + or . in it, rel:find(part .. "/") fails because find in this context is likely treating the string as a Pattern (Regex) rather than a plain string.
To fix this, we need to tell the find function to treat the string literally. In Lua, you do this by adding true as argument to find, which enables “plain text” searching.

for part in rel:gmatch("[^/]+") do
    current[part] = current[part] or {} 
    
    -- Added '1, true' to treat 'part' as plain text and avoid Regex errors
    if not rel:find(part .. "/", 1, true) then 
        current[part]._path = f.name 
    end
    current = current[part]
end

I already pushed the fix (hopefully this will fix it) tested it with: +, ?, * in names.

[UpdateLog]

  • minor fixes
  • added -- priority: 0 to the space-lua to solve config priority issues
  • tree logic fix for names with special characters like +, ?, * in files/folder names
  • removed the two shortcut keys (for Sidepanel/Window) and replaced them with a toggle button in the UI
    now the only remaining Shortcut key is to Toggle using Ctrl-Alt-e and you can switch to the other mode in the UI.

Thanks for the appreciation.

It started out a a simple image/gallery viewer widget for pages. and now 11 days and 1000 lines of code later it somehow resulted in what you see now. I’m also happy to see where this is going, but the code is getting unmanageable in a single file. And i definitely don’t want to add more files & complexity to it.
The coming days I will try to clean up the code, to make it more human readable.

2 Likes

Before adding new features I wanted to clean up the CSS and in this process I also added a new config option for List&TreeView.

Now you can change the RowHeight using the explorer.listHeight.

Also changed the header and the altogether feel of the explorer to a more compact design so it fits more of your awesome pages and files in the view. Here is the full changelog.

[UpdateLog]

  • Cleaned up CSS
  • added explorer.listHeight config option to set your custom height of the List&Tree element
  • more compact header
  • minor fixes

And a screenshot with an overview of the main features :

I’d be happy to hear your feedbacks about the current state? is this something you would use daily? did you found any bugs, anything you’d want an option added.

  • Currently i’m working on ading a Collapse all: +/- button for Treeview.
4 Likes

Amazing .It will replace treeview plug. Live filtering is a little bit laggy.

It has to be a plugins provided by default .

1 Like

Great already!

Just as I wanted to ask for a “collapse all” for treeview, I read, you already working on it :wink:

The filter input is also great! Thanks for that.

But another thing:
I have a lot of pages, which are “parent” folders at the same time (or let’s say, they share the same name).
What bothers me a little (!) bit, it is not clearly visible, if a page has also a folder (or vice versa), as folders are in the upper sections and the pages on the lower.

Could it be possible to somehow combine folders with pages with the same name? Don’t know how exactly this should look like, but maybe the folder with another symbol, if there’s a page with the same name? And then klicking on the symbol to open the folder, click on the text to open the page?
Or add a symbol or change the style (like “bold”) of entries with page/folder combination?

Hope, you understand, what I’m after :slight_smile:

1 Like

Oh, just another idea:
It might be nice to have kind of “reverse” filter option as settings.
That would make it possible to hide some pages or folders from the tree by default (I don’t want to see a some folders during daily use, like “SETTINGS” or “_EXPORT” or “Library” :wink:

(Plus-feature: A button to ignore this setting for the moment, if one DOES need to jump to a hidden page through the explorer - on the other hand it’s still accessible by the pickers… :wink:

Thanks for the fixes ! The treeview works great now.
For the config parameters, the only thing that works is to set the priority of code to -1 (not 0)!! The problem seems to be specific to my installation. I deal with it.
Thanks a lot !

For the latest version : beautiful and super practical !

On my installation, i changed the icons in the tree and list view:

  • for files (in space-lua): “:black_small_square:” instead of specific icons by type
  • for folder prefix (css): “─” instead of “➤”

Thus, the visual is lightened, what suits me best. Illustration:

I really like (among other things):

  • the badges by file type
  • switch from an image folder open in a list or tree view, to the view with thumbnails

Two proposals:

  • sort files separately from folders
  • for the tree-view: when opening, do not deploy all the levels (while positioning yourself on the current document, as is currently the case)

Thank you again for this enormous work! :clap:

1 Like

@Mr.Red, can you clarify which library is the correct one? Reading DocumentExplorer.md is deprecated and to use VirtualPageDocumentExplorer.md, but seeing four hours and three days updates, respectively, in your git repo.

Want to make sure I grab the correct one. Thank you!

this one is deprecated:

and this is the correct one:

1. Make sure you removed both of them first

2. Update The Repo

3. Install the correct one:

1 Like

I’ve been thinking about sorting as well. At the moment, sorting (both List and Grid views) is based on folders first, followed by file types (MD, PDF, images, etc.).

In the future, I plan to rethink the entire sorting concept. Most likely, I’ll move toward a more straightforward alphabetical sorting, rather than grouping by file types.

For the Tree View, I’m also planning to keep a folders-first, then files alphabetically approach. As mentioned before, the next feature I’ll be adding is a collapse / expand all (+ / −) button. This should help a lot with managing how folders are folded and unfolded, and make navigation much smoother.

This is actually one of the reasons why I personally prefer libraries over plugins :slightly_smiling_face:
Libraries are just a single Markdown page, which makes them much easier for users to customize and adapt to their own needs, styles and workflows.

Plugins, even though they’re also open source and can be modified or built from scratch, tend to be more rigid in this regard. Libraries offer a bit more flexibility and freedom for personalization.

Thanks a lot for the feedback — it’s really appreciated! :raising_hands:

1 Like

I didn’t look at the library manager but went directly to the git repo. Your description is very clear.. lessoned learned, use the Library manager. :smiley:

1 Like