obsidian-folder-note-plugin icon indicating copy to clipboard operation
obsidian-folder-note-plugin copied to clipboard

Preview of folder-note in the folder brief shows the current note

Open ibestvina opened this issue 4 years ago • 7 comments

Steps to reproduce:

  1. Add FOLDER-BRIEF-LIVE to the contents and set file-outside-folder mode.
  2. Create the following folder structure:
 - root
     - folder1
         - folder2
  1. Create a note for folders 1 and 2
  2. Open folder 1 note
  3. As described in #7 , both folder2 and folder2_note are shown as cards. Hovering over the note card, preview of folder1 note is shown (although the title of the preview says folder2).

image

This is really hard for me to understand, because clicking on the card correctly takes you to the folder2 note.

I tested other configs:

  • FOLDER-BRIEF (non-live) works fine
  • File inside folder (index or named) doesn't have this problem because it doesn't show the child folder as a note (since folder2.md is not inside folder1)

ibestvina avatar Feb 18 '21 16:02 ibestvina

p.s. sorry for dumping all these issues, your plugin is great, and deserves a coffee! Sadly I'm not able to help much with it apart from finding bugs - JS is not really my area.

ibestvina avatar Feb 18 '21 16:02 ibestvina

Thanks for the coffee! And Thanks for the detailed feedback and suggesions.

The folder_brief_live uses the folder path of the active file (opened in the current view) to generate overview except a folder key is specified. When you hover a note card to peek its content and the note contians a folder_brief_live block, it will use the folder path of the active file instead of its own folder path.

The only way to solve the problem is using the folder path of the real note instead of the active note. However, there is no function in the Obsidian's API to get the real note path for a hover view. So I will let the issue open untill it is supported.

Alternatively, if you want to show the correct content for a note including folder_brief_live for hovering peeking, add a folder key to specify the full folder path, though it would be a little bit inconvenient.

xpgo avatar Feb 19 '21 02:02 xpgo

Oh, I get it now, that makes sense yes. I don't think this is a big issue, I was more wondering how it can even happen. But this explanation makes perfect sense, thanks! I'll trying playing around with it myself a bit, although my TS skills are very limited. If I manage to find something good, I'll make a PR.

EDIT: thinking some more about, maybe it's possible to solve it the same way #2 was fixed - if you add folder_path key to the ccard, I presume current note folder is available when note is being created. So we could do something like this in the content config:

```ccard
type: folder_brief_live
imagePrefix: 'at/'
folderPath: {{FOLDER_PATH}}
```

That is then stored in the note and keeps track of where this note is. I presume however it would produce problems if the folder is moved. But I really don't think this is important - as I said, I mostly opened this issue to understand how it can even happen, so as fair as I'm concerned, it is a closed issue for me!

ibestvina avatar Feb 19 '21 10:02 ibestvina

Now the keyword {{FOLDER_PATH}} has been added. FYI, you should use the key folder: {{FOLDER_PATH}} instead of folderPath: {{FOLDER_PATH}}. The key folder has already been supported in previous releases. For more information, please see ccard syntax.

Accually, I am new to TS too. I never used TS before developing this plugin. I use python a lot. So codes of my plugin may look bad to TS and JS experts. Welcome to make PR.

xpgo avatar Feb 19 '21 11:02 xpgo

Thanks a lot, I'll make sure to check ccard details. I'm a py dev too - happy to hear you're a TS beginner and yet managed to build such a great plugin!

ibestvina avatar Feb 19 '21 14:02 ibestvina

🤝, thanks, I just want to say that if we were familiar with python, TS should not be difficult to use. Obsidian's plugin API gives us a good chance to add our own ideas to a note taking app. Some plugins have only few lines of codes. You have many good ideas, so you could try to implement some of them with plugin. For example, I have developed another two plugins with few lines of codes:

xpgo avatar Feb 20 '21 00:02 xpgo

This looks great, thanks for encouragement - I'll definitely take a deep dive into your plugins here and maybe try to build something on my own, or at least be able to contribute to your work instead of just opening issues :)

ibestvina avatar Feb 20 '21 15:02 ibestvina