alangrainger / obsidian-frontmatter-modified-date

Automatically update a frontmatter/YAML modified date field
MIT License
63 stars 10 forks source link

Add wildcards to excluded folder paths #16

Open Kuoxsr opened 8 months ago

Kuoxsr commented 8 months ago

If you try to expand the input box for "exclude folders" in the settings page (so that you can actually see what you are adding), you encounter very strange behavior:

An up/down mouse motion expands and contracts the control vertically as one might expect, however, since the grab bar is in the lower right corner, you get a mirrored expansion/contraction horizontally. In other words, if I want the box to expand to the left, I need to move my mouse to the right. Moving right makes the left edge travel further to the left while the right edge stays basically in place, and vice-versa. This is not intuitive.

To make matters even worse: The size and position of the control does not remain when visiting the settings page a second time, so the user has to take this non-intuitive action every time they want to see their whole list.

Since we seem to have no ability to move the grab bar to the lower left corner (according to my research on TextArea), might I suggest the following:

Put the text on top of the box (rather than to its left), and make the box fill the entire width of the space below the description by default. This way the top, left and right sides of the box can appear locked in place, and the user would only be changing the bottom edge position. The description wouldn't need to change its shape at all, since it wouldn't be sharing any horizontal space with the input box. It would be on a separate line above the box. That might require making raw text for the description, and then having an unlabeled TextArea beneath it.

Thanks for reading this feature request, and happy coding!

Kuoxsr commented 8 months ago

I just thought of another idea for this:

How about instead of specifying a series of folders in a single control in the settings page, the user would specify an .md file from their vault instead?

The app could read that .md file, and any path in that document would be excluded. You could also drag individual files to the document to create links like [[file-name]] and that would allow you to exclude individual files without having to specify any yaml in the document you want to exclude.

This would take care of many issues at once: It would cover entire folders and individual files in the same way. The individual files wouldn't need any yaml in them at all (which is kind of why I'm excluding folders to begin with - I don't want certain documents to have yaml properties at all). Also, the control in question on the settings page could be a single entry text box rather than multi-line, eliminating the janky resize mechanic. Another benefit of this is that if a user has multiple vaults, they could exclude different sets of files in each one without overlap, since the .md files would be local to each vault.

Anyway, thanks again for listening. Have a fantastic day!

alangrainger commented 8 months ago

Hi @Kuoxsr - I really appreciate the detailed request.

Unfortunately, the behaviour you're critiquing is native Obsidian, it's not anything to do with this plugin.

If you want, you can edit the data.json file directly in the .obsidian/plugins/frontmatter-modified-date folder.

It has a format like this, and you can easily modify it with any text editor:

  "excludedFolders": [
    "Folder1",
    "Folder2"
  ],
Kuoxsr commented 8 months ago

Thanks for the workaround!

Did you happen to notice my second post? It's a vault-independent alternative technique for gathering paths from the user without needing a TextArea at all. It also would allow drag-n-drop to get file paths into the collection without special code on your part. You would just get that feature for free.

Anyway, I assume that the paths in data.json are relative to the obsidian vault? It doesn't really mention this anywhere in your docs (at least not that I found... I could be blind)

Also, I assume that you cannot specify something like */public to exclude all files in paths that end with a folder called "public?" <- this would be the bomb if it was possible. In my list, it would cut 5 (or more) path specifications down to one.

alangrainger commented 8 months ago

Totally, but it's a huge amount of work to solve a problem which isn't really that bad, and which Obsidian might update their software to fix anyway. The textarea in my settings resizes exactly the same as the textarea in the settings for any plugin, so it's consistent with Obsidian UX (since it uses Obsidian's native settings elements).

*/public is a great idea, I'll leave this issue open but rename it to "Add wildcards to excluded folder paths".