title: $:/core/macros/tag-picker tags: tags: $:/tags/Macro $:/tags/Global first-search-filter: [subfilter!is[system]search:titlesort[]] second-search-filter: [subfilteris[system]search:titlesort[]] \whitespace trim \function tf.tagpicker-dropdown-id() [] [[$(saveTiddler)$-[$(tagField)$-$(tagListFilter)$]substitute[]sha256[]] +[join[/]] \end \function tf.tagpicker-dropdown-class() [sha256[]addprefix[tc-]] \function tf.get-tagpicker-focus-selector() [addprefix[.]] .tc-popup-handle +[join[ ]] \procedure delete-tag-state-tiddlers() <$action-deletetiddler $filter="[] [] []"/> \end \procedure add-tag-actions() <$let tag=<<_tf.getTag>> > <$action-listops $tiddler=<> $field=<> $subfilter='+[toggletrim[]]'/> <% if [] :intersection[getenlist-input[]] %> <% else %> <> <% endif %> <> <$action-setfield $tiddler=<> text="yes"/> \end \procedure clear-tags-actions-inner() <% if [has[text]] ~[has[text]] %> <> <% else %> <> <% endif %> \end \procedure clear-tags-actions() <$let userInput=<<_tf.getUserInput>> > <$list filter="[get[text]!match]" > <$list-empty> <> <$action-setfield $tiddler=<> text=<>/> <$action-setfield $tiddler=<> text="yes"/> \end \procedure add-button-actions() <$action-listops $tiddler=<> $field=<> $subfilter="[trim[]]"/> <> <> <$action-sendmessage $message="tm-focus-selector" $param=<>/> \end \procedure tag-picker-listTags(filter, suffix) <$let userInput=<<_tf.getUserInput>> > <$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="
{{$:/language/Search/Search/TooShort}}
" variable="listItem" > <$list filter=<> variable="tag"> <$let currentTiddler=<> button-classes=`tc-btn-invisible ${[addsuffix] -[get[text]] :then[[]] ~tc-tag-button-selected }$` get-tagpicker-focus-selector=`${[]}$` > {{||$:/core/ui/TagPickerTagTemplate}} \end \procedure tag-picker-inner()
] +[join[ ]] }}}>
<$macrocall $name="keyboard-driven-input" tiddler=<> storeTitle=<> refreshTitle=<> selectionStateTitle=<> inputAcceptActions=<> inputCancelActions=<> tag="input" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex=<> focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} filterMinLength={{$:/config/Tags/MinLength}} cancelPopups=<> configTiddlerFilter="[[$:/core/macros/tag-picker]]" /> <$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}} > {{$:/core/images/down-arrow}} <% if [has[text]] %> <$button actions=<> class="tc-btn-invisible tc-small-gap tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/ClearInput/Hint}} aria-label={{$:/language/EditTemplate/Tags/ClearInput/Caption}} > {{$:/core/images/close-button}} <% endif %> <$let tag=<<_tf.getTag>>> <$button set=<> actions=<> > {{$:/language/EditTemplate/Tags/Add/Button}}
<% if [has[text]] %>
<$macrocall $name="tag-picker-listTags" filter=<> suffix="-primaryList" />
<$macrocall $name="tag-picker-listTags" filter=<> suffix="-secondaryList" />
<% endif %>
\end \procedure tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]]") \function _tf.getUserInput() [get[text]] \function _tf.getTag() [get[text]] <$let palette={{$:/palette}} colourA={{{ [getindex[foreground]] }}} colourB={{{ [getindex[background]] }}} fallbackTarget={{{ [getindex[tag-background]] }}} saveTiddler={{{ [is[blank]thenelse] }}} newTagNameTiddler={{{ [[$:/temp/NewTagName]] [!match[tags]] +[join[/]] [] +[join[]] }}} storeTitle={{{ [[$:/temp/NewTagName/input]] [!match[tags]] +[join[/]] [] +[join[]] }}} newTagNameSelectionTiddlerQualified=<> tagSelectionState={{{ [!match[]] ~[] }}} refreshTitle=<> nonSystemTagsFilter="[subfilter!is[system]search:titlesort[]]" systemTagsFilter="[subfilteris[system]search:titlesort[]]" cancelPopups="yes" > <$macrocall $name="tag-picker-inner"/> \end