mo-seph / obsidian-note-from-template

Simple plugin to create Notes from a template, and fill in fields defined there
MIT License
108 stars 9 forks source link

Dropdowns and other field types #5

Closed Lulullia closed 2 years ago

Lulullia commented 2 years ago

Hi!

This might already be possible, but since there's nothing about it in the readme, I still need to ask!

Having different field types would be really useful. The main thing I can think about now is dropdowns with predefined values. It could look something like this:

{{dropdown:'option1', 'option2', 'option3'}}

Then when creating a file from that template, we'd be able to choose between options.

Other field types could be nice too, like date (with a calendar popping up to select the date/time), number with range...

FelipeRearden commented 2 years ago

I agree 300% with you @Lulullia !!!!!!!!

mo-seph commented 2 years ago

Definitely possible, and I had this idea in mind - I'm not much of a UI person, so I'm happy for pull requests or fragments that would help make that all work.

agnoldo commented 2 years ago

Hello! First of all, thank you @mo-seph for the great work so far!

Another idea would be implement special types like date, date/time, time, boolean and integer, all of them with special inputs.

mo-seph commented 2 years ago

There's a version in development that supports forms like this: {{suit:choice:hearts:spades:diamonds:clubs}} to get a dropdown with a choide between hearts, spades, diamonds and clubs. I had a look at using SearchComponent to find other notes, and another one for times, but I haven't found any other useful bits of ui - any pointers welcome!

mo-seph commented 2 years ago

I've added one more type: {{now:currentdate:dd-MM-yyyy}}. This should also work for the current time as well - it uses templates from Luxon (https://moment.github.io/luxon/#/formatting).

For other types, I probably won't get to it without help on the UI side of things or a strong demand.