Templater icon indicating copy to clipboard operation
Templater copied to clipboard

multiple select prompt

Open depressiveRobot opened this issue 4 years ago • 10 comments

Is your feature request related to a problem? Please describe. I want to be able to spawn a suggester prompt with the possibility to select multiple items.

Describe the solution you'd like A System Module function which spawns a multiple selections prompt and returns the user's chosen items as a comma-separated list.

Similar to the suggester function of the System Module, it could look like this:

tp.system.multipleselect(text_items: string[] ⎮ ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "")

which then returns a string value1, value2, value3.

Describe alternatives you've considered Maybe it's possible to extend the suggester function to allow for multiple select.

depressiveRobot avatar Dec 02 '21 15:12 depressiveRobot

You are correct that suggester could be invoked multiple times. Supercharged links did this but it recently split off into two different plugins, one of which retains this behavior.

AB1908 avatar Jul 18 '22 12:07 AB1908

Is this likely to be supported at some point?

mayurankv avatar Oct 26 '22 22:10 mayurankv

It's unlikely to happen in the near future I think. None of the maintainers have the time.

AB1908 avatar Oct 27 '22 10:10 AB1908

You could kind of accomplish this by running the suggester multiple times in a loop...

const selections = []
while (selections.length <= 3) {
    const selection = await tp.system.suggester(["foo","bar","baz"],[1,2,3])
    selections.push(selection)
}
// do stuff with selections

shabegom avatar Oct 28 '22 01:10 shabegom

Its a good idea but ideally, you'd be able to choose how many options you end up choosing right and idk of a way to do that without a confirm end prompt between each solution which would just be horrible ux. (i.e. for choosing what languages you speak - some speak 1 others speak 5).

Just as reference, if I could introduce new prompts to the tp.system, I would add:

  • Multiline suggester (either fixed or unfixed number of items)
  • Slider between two value
  • Date selection
  • Time selection

I know these can already be pretty easily done so they should be far from the top of the list, but improving user input ux would go a long way in allowing pre-populating of notes.

It would just be lovely if this was core though of course I understand the maintainers are busy with other more important things. Really appreciate all the time all of you have put into this!

mayurankv avatar Oct 28 '22 10:10 mayurankv

Can you check if the metadata menu plugin fits your needs?

AB1908 avatar Oct 28 '22 22:10 AB1908

I've been meaning to take a dive into that. I'll have a look when I can and let you know. Thanks for the suggestion!

mayurankv avatar Nov 01 '22 12:11 mayurankv

I think it would be very helpful to have multi select prompt. Is there anyone working on this, I would like to try working on this feature.

sujyotraut avatar Jul 22 '23 06:07 sujyotraut

Please go ahead and submit a draft PR, I'm more than happy to provide feedback.

AB1908 avatar Jul 22 '23 22:07 AB1908

Hello @AB1908 I just submitted a draft PR, Please take a look at it and tell me if anything can be improved.

sujyotraut avatar Jul 23 '23 15:07 sujyotraut