How to filter (limit) the tag-picker macro's autocomplete dropdown?

Use tag picker macro is as simple as

{{||$:/core/ui/EditTemplate/tags}}

but it will show all available tags. How to filter the list with filter like [prefix[$:/plugins/linonetwo/tags/]] or [tag{$:/plugins/linonetwo/intention-tower-knowledge-graph/Config/task-tag}]?

As a plugin developer, I want to create a liminted tag-picker for some plugin config.

Hi,

As a plugin developer, I want to create a liminted tag-picker for some plugin config.

The tag-picker macro has been updated to work with tag-like fields. See: tag-picker + examples in the official TW-prerelease

The tag-picker has a tagListFilter parameter now (TW v5.3.4). I should be possible to use that one in a way that it works for you.

You need to overwrite \procedure edit-tags-template(tagField:"tags") and modify the line that contains <$macrocall $name="tag-picker" tagField=<<tagField>>/>

eg:

  • create eg: $:/my/ui/EditTemplate/tags
\import $:/core/ui/EditTemplate/tags

\procedure edit-tags-template(tagField:"tags")
<div class="tc-edit-tags">
	<$list filter="[<currentTiddler>get<tagField>enlist-input[]sort[title]]" storyview="pop">
		<$macrocall $name="tag-body"
			colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
			palette={{$:/palette}}
			icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
			tagField=<<tagField>>
		/>
	</$list>
	<$let tabIndex={{$:/config/EditTabIndex}} cancelPopups="yes">
<!-- See the follwing line -->
		<$macrocall $name="tag-picker" tagField=<<tagField>> tagListFilter="[prefix[aa]]"/>
	</$let>
</div>
\end
<$let saveTiddler=<<currentTiddler>>>
	<$macrocall $name="edit-tags-template" tagField=<<tagField>>/>
</$let>

The new tag input can be used with

{{||$:/my/ui/EditTemplate/tags}}

I barely forget I have seem your PR that update this!

Thank you for update the doc and add new feature, I can use this now, because I’m using prerelease of tw in TidGi.