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
325 stars 16 forks source link

[FR]: Folder note name #11

Closed valteriomon closed 1 year ago

valteriomon commented 1 year ago

Hi! I tried all the "folder note" plugins and this is by far the best, it's just missing the option to be able to "customize" the created filename:

I'd be open to implement it and send a PR your way. Thx for the great work!

LostPaul commented 1 year ago

I'd be open to implement it and send a PR your way. Thx for the great work!

That would be great

valteriomon commented 1 year ago

So... it was a bit more complicated than expected :) the plugin did a lot of things I wasn't aware of, and I ran into a problem trying to adapt the renaming aspect to the new naming methods.

Here is what I have so far: https://github.com/valteriomon/obsidian-folder-notes But here is the issue I have: My idea was, if you name your folder notes are named "Index" and rename one of them, it just stops being a folder note, if you name it "Index" again, it becomes the folder note again. If you use the prefix, and rename a folder note without altering the prefix, it works as it works now, editing the folder name. But if in the rename you break the prefix, it stops being the folder note. Now, a test I'm trying but fails to work is: 1) set prefix as renaming method 2) create folder note, edit the prefix. warning is shown, folder note "untracked", this is ok 3) create new folder note, edit the name without altering the prefix, folder is renamed... but the warning is still shown as the rename event still runs on previously renamed file.

I tries a bunch of things, with this.app.vault.off and this.app.vault.offref, but I'm stuck there.

Oh and I realised that when you change your settings, it might be needed to rename all your folder notes accordingly? if you change the index or the prefix I mean... which I hadn't considered might be needed when I opened the FR. I'm not sure how you will feel about that. Anyways, if you feel this is all too much and it's not something you want the plugin to do for now I'd get it, and you can dismiss all this and close the issue.

LostPaul commented 1 year ago

So... it was a bit more complicated than expected :) the plugin did a lot of things I wasn't aware of, and I ran into a problem trying to adapt the renaming aspect to the new naming methods.

Here is what I have so far: https://github.com/valteriomon/obsidian-folder-notes But here is the issue I have: My idea was, if you name your folder notes are named "Index" and rename one of them, it just stops being a folder note, if you name it "Index" again, it becomes the folder note again. If you use the prefix, and rename a folder note without altering the prefix, it works as it works now, editing the folder name. But if in the rename you break the prefix, it stops being the folder note. Now, a test I'm trying but fails to work is:

1. set prefix as renaming method

2. create folder note, edit the prefix. warning is shown, folder note "untracked", this is ok

3. create new folder note, edit the name without altering the prefix, folder is renamed... but the warning is still shown as the rename event still runs on previously renamed file.

I tries a bunch of things, with this.app.vault.off and this.app.vault.offref, but I'm stuck there.

Oh and I realised that when you change your settings, it might be needed to rename all your folder notes accordingly? if you change the index or the prefix I mean... which I hadn't considered might be needed when I opened the FR. I'm not sure how you will feel about that. Anyways, if you feel this is all too much and it's not something you want the plugin to do for now I'd get it, and you can dismiss all this and close the issue.

Alright I'll try to code it by myself

LostPaul commented 1 year ago

Is this how you want it? Currently it doesn't update all existing folder notes when you change it in the settings I've to find a solution for that maybe something like after 5 seconds of the last input all folder notes get updated and the user has to wait until all have been updated?

https://github.com/LostPaul/obsidian-folder-notes/assets/70213368/68413b70-cca6-4cdf-ab8c-607aa1dd5f61

valteriomon commented 1 year ago

Yes that looks great!! I wouldn't mind for it to not get updated and have it to do manually or using an external script, but your solutions sounds good to me. I'm sure someone down the line will request for it.

LostPaul commented 1 year ago

Is this how you want it?

Currently it doesn't update all existing folder notes when you change it in the settings I've to find a solution for that maybe something like after 5 seconds of the last input all folder notes get updated and the user has to wait until all have been updated?

https://github.com/LostPaul/obsidian-folder-notes/assets/70213368/68413b70-cca6-4cdf-ab8c-607aa1dd5f61

You can now update the existing folder notes with a button in the settings