Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Default value for suggester

Open RyanQuey opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I want to have a default value for suggester. Placeholder is ok, but having a default value is often helpful, e.g., when I want to search all markdown files based on a previous user input.

Describe the solution you'd like Add a param for default value

Describe alternatives you've considered Using placeholder, and have user type in the input again.

RyanQuey avatar Feb 09 '22 05:02 RyanQuey

@RyanQuey I also needed this functionality. I just added the PR for that. But until it is released you can use a hack for that

const valuePromise = tp.system.suggester(text_items, items, throw_on_cancel, placeholder, limit);

setTimeout(() => {
	const input = document.querySelector('.prompt-input');
	input.value = initial_query;
	input.dispatchEvent(new InputEvent('input'));
}, 0);

const value = await valuePromise;

mnaoumov avatar Jul 08 '23 14:07 mnaoumov