LostPaul / obsidian-folder-notes

Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.
https://lostpaul.github.io/obsidian-folder-notes/
GNU Affero General Public License v3.0
264 stars 11 forks source link

Feat use file explorer #5

Closed cdloh closed 1 year ago

cdloh commented 1 year ago

This enables loading of classes before hand so that the user experience is cleaner whilst browsing the file tree

I've hooked a few more events up to support this so that CSS classes can be updated as they go

Note that it requires the changes from #4 if that MR needs changes I'll rebase this one.

LostPaul commented 1 year ago

Hey @cdloh I'm currently not at home until friday but I'll try to review the changes as early as possible thank you for your work!

cdloh commented 1 year ago

No stress @LostPaul. Note that I made some changes to the way that renaming works for files to make it more consistent.

Apologies as this is a fairly large set of changes so if you'd rather me somehow split it up into smaller changes I can give that a shot.

LostPaul commented 1 year ago

Apologies as this is a fairly large set of changes so if you'd rather me somehow split it up into smaller changes I can give that a shot.

That would be great

LostPaul commented 1 year ago

It doesn't seem to be adding the has folder note class when a new folder note has been created

cdloh commented 1 year ago

@LostPaul forgot to push the styles changes. As it's now applied to the parent DIV gotta change the styles slightly.

LostPaul commented 1 year ago

@cdloh I didn't mean the style isn't applied but the folder html element doesn't even have the css class I checked it with the dev tools and other folder names were underlined.

cdloh commented 1 year ago

I've just tested this branch locally again and it's working fine when I either create the note manually or use the Command menu.

I'm running insider but I doubt that would make any difference for this

LostPaul commented 1 year ago

I've just tested this branch locally again and it's working fine when I either create the note manually or use the Command menu.

I'm running insider but I doubt that would make any difference for this

Does it also work for you with ctrl + clicking on the folder name?

LostPaul commented 1 year ago

Or nvm I'm not sure anymore if I had used the right version I'll try it later again

LostPaul commented 1 year ago

I had this error spam in the console @cdloh image

LostPaul commented 1 year ago

The element doesn't even seem to exist image

LostPaul commented 1 year ago

What version of Obsidian are you running? Are you using a custom file explorer?

The latest insider version and no

What do you get back from app.workspace.getLeavesOfType('file-explorer')[0].view.files

I'm currently not at my pc I'll tell you this later

cdloh commented 1 year ago

What version of Obsidian are you running? Are you using a custom file explorer?

What do you get back from app.workspace.getLeavesOfType('file-explorer')[0].view.fileItems['/'] or replace / with any valid file path.

cdloh commented 1 year ago

@LostPaul I downloaded latest insiders and the API has changed in 1.2.2

I've pushed a fix for it. Odd as it's been stable for a chunk of versions.

LostPaul commented 1 year ago

Yeah now it works for me

LostPaul commented 1 year ago

But will it work in older versions?

cdloh commented 1 year ago

I've made it default to the old version of the API and only use new version when available. Ideally once 1.2.2 goes Public Release cut a new version of the app with the old API version cleaned up and then bump the minimum app version.

LostPaul commented 1 year ago

Deleting a folder note currently doesn't remove the class from the folder

LostPaul commented 1 year ago

Found the issue

LostPaul commented 1 year ago

Not sure yet what it causes but currently I one folder still collapses @cdloh https://user-images.githubusercontent.com/70213368/230781118-0bebc6a8-be3e-4e66-a023-b7a48d9018e1.mp4

or am I dumb and blacklisted the folder I'm not sure anymore

cdloh commented 1 year ago

Updated to fix parent / children issues with adding classes to DIV as the element I was using included children, instead of just that folder.

cdloh commented 1 year ago

Not sure yet what it causes but currently I one folder still collapses @cdloh https://user-images.githubusercontent.com/70213368/230781118-0bebc6a8-be3e-4e66-a023-b7a48d9018e1.mp4

Can you compare to the old version of the plugin? I'm not entirely sure what the functionality is meant to look like here.

I'm not sure what the functionality is meant to do here

LostPaul commented 1 year ago

Not sure yet what it causes but currently I one folder still collapses @cdloh https://user-images.githubusercontent.com/70213368/230781118-0bebc6a8-be3e-4e66-a023-b7a48d9018e1.mp4

Can you compare to the old version of the plugin? I'm not entirely sure what the functionality is meant to look like here.

I'm not sure what the functionality is meant to do here

Everything seems to work fine. I'm not sure if I excluded the folder. The attachments folder shouldn't collapse normally, but I also couldn't reproduce it.

LostPaul commented 1 year ago

Until which version of obsidian does the plugin now work @cdloh ?

cdloh commented 1 year ago

It will work with all versions @LostPaul

The changes needed for 1.2.X are backwards compatible. When other changes are made that aren't backward compatible that code can be cleaned up.

LostPaul commented 1 year ago

It will work with all versions @LostPaul

The changes needed for 1.2.X are backwards compatible. When other changes are made that aren't backward compatible that code can be cleaned up.

Alright has anything else improved besides the css classes getting applied and removed when they should? (for the release notes) @cdloh

cdloh commented 1 year ago

Styles now work from startup and are applied correctly regardless of file explorer status (ie if the child is shown / expanded) and automatically updates styles when files change.

File Renaming is now handled in a few more scenarios.

Excluded folder now correctly cascades to more than one folder down.