2016-11-28 19:17:25 +00:00
|
|
|
title: $:/core/macros/tag-picker
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
|
2020-07-13 16:42:55 +00:00
|
|
|
\define delete-tag-state-tiddlers() <$action-deletetiddler $filter="[<newTagNameTiddler>] [<storeTitle>] [<tagSelectionState>]"/>
|
|
|
|
|
2020-06-11 11:12:45 +00:00
|
|
|
\define add-tag-actions(actions)
|
2020-07-13 16:42:55 +00:00
|
|
|
<$set name="tag" value={{{ [<__tiddler__>get[text]] }}}>
|
|
|
|
<$list filter="[<currentTiddler>!tag<tag>]" variable="ignore" emptyMessage="""
|
|
|
|
<$action-sendmessage $message="tm-remove-tag" $param=<<tag>>/>
|
|
|
|
""">
|
2020-06-11 11:12:45 +00:00
|
|
|
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
|
|
|
|
$actions$
|
2020-07-13 16:42:55 +00:00
|
|
|
</$list>
|
2020-06-11 11:12:45 +00:00
|
|
|
</$set>
|
2020-07-13 16:42:55 +00:00
|
|
|
<<delete-tag-state-tiddlers>>
|
|
|
|
<$action-setfield $tiddler=<<refreshTitle>> text="yes"/>
|
2018-04-02 18:43:18 +00:00
|
|
|
\end
|
|
|
|
|
2020-07-13 16:42:55 +00:00
|
|
|
\define tag-button(actions,selectedClass)
|
|
|
|
<$button class="tc-btn-invisible $selectedClass$" tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
|
2019-10-13 15:53:40 +00:00
|
|
|
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
|
2020-07-13 16:42:55 +00:00
|
|
|
<<delete-tag-state-tiddlers>>
|
2020-06-11 11:12:45 +00:00
|
|
|
$actions$
|
2016-11-28 19:17:25 +00:00
|
|
|
<$macrocall $name="tag-pill" tag=<<tag>>/>
|
|
|
|
</$button>
|
|
|
|
\end
|
|
|
|
|
2020-07-13 16:42:55 +00:00
|
|
|
\define clear-tags-actions()
|
|
|
|
<$list filter="[<__storeTitle__>has[text]] [<__tiddler__>has[text]]" variable="ignore" emptyMessage="""<<delete-tag-state-tiddlers>><$action-sendmessage $message="tm-cancel-tiddler"/>""">
|
|
|
|
<<delete-tag-state-tiddlers>>
|
|
|
|
</$list>
|
|
|
|
\end
|
|
|
|
|
2020-06-11 11:12:45 +00:00
|
|
|
\define tag-picker-inner(actions)
|
2020-01-30 15:41:21 +00:00
|
|
|
\whitespace trim
|
2020-07-13 16:42:55 +00:00
|
|
|
<$vars tagSelectionState=<<qualify "$:/state/selected-tag">> storeTitle=<<qualify "$:/temp/NewTagName/input">> refreshTitle=<<qualify "$:/temp/NewTagName/refresh">> nonSystemTagsFilter="[tags[]!is[system]search:title<userInput>sort[]]" systemTagsFilter="[tags[]is[system]search:title<userInput>sort[]]">
|
2016-11-28 19:17:25 +00:00
|
|
|
<div class="tc-edit-add-tag">
|
2020-06-11 11:12:45 +00:00
|
|
|
<div>
|
2016-11-28 19:17:25 +00:00
|
|
|
<span class="tc-add-tag-name">
|
2020-07-13 16:42:55 +00:00
|
|
|
<$macrocall $name="keyboard-driven-input" tiddler=<<newTagNameTiddler>> storeTitle=<<storeTitle>> refreshTitle=<<refreshTitle>>
|
|
|
|
selectionStateTitle=<<tagSelectionState>> primaryListFilter=<<nonSystemTagsFilter>> secondaryListFilter=<<systemTagsFilter>>
|
|
|
|
inputAcceptActions="""<$macrocall $name="add-tag-actions" actions=<<__actions__>>/>""" inputCancelActions=<<clear-tags-actions>> tag="input"
|
|
|
|
placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/popup/tags-auto-complete">>
|
|
|
|
class="tc-edit-texteditor tc-popup-handle" tabindex=<<tabIndex>> focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}}
|
|
|
|
filterMinLength={{$:/config/Tags/MinLength}} cancelPopups=<<cancelPopups>> />
|
2020-06-11 11:12:45 +00:00
|
|
|
</span> <$button popup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button> <span class="tc-add-tag-button">
|
2019-10-14 13:31:57 +00:00
|
|
|
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
|
2020-07-13 16:42:55 +00:00
|
|
|
<$button set=<<newTagNameTiddler>> setTo="" class="">
|
|
|
|
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
|
|
|
|
$actions$
|
|
|
|
<<delete-tag-state-tiddlers>>
|
2016-11-28 19:17:25 +00:00
|
|
|
{{$:/language/EditTemplate/Tags/Add/Button}}
|
|
|
|
</$button>
|
|
|
|
</$set>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="tc-block-dropdown-wrapper">
|
|
|
|
<$reveal state=<<qualify "$:/state/popup/tags-auto-complete">> type="nomatch" text="" default="">
|
2020-07-13 16:42:55 +00:00
|
|
|
<div class="tc-block-dropdown tc-block-tags-dropdown">
|
|
|
|
<$set name="userInput" value={{{ [<storeTitle>get[text]] }}}>
|
|
|
|
<$list filter="[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
|
|
|
|
<$list filter=<<nonSystemTagsFilter>> variable="tag">
|
|
|
|
<$list filter="[<tag>addsuffix[-primaryList]] -[<tagSelectionState>get[text]]" emptyMessage="""<$macrocall $name="tag-button" actions=<<__actions__>> selectedClass="tc-tag-button-selected"/>""">
|
2020-06-11 11:12:45 +00:00
|
|
|
<$macrocall $name="tag-button" actions=<<__actions__>>/>
|
2020-07-13 16:42:55 +00:00
|
|
|
</$list>
|
2018-04-02 18:43:18 +00:00
|
|
|
</$list></$list>
|
2016-11-28 19:17:25 +00:00
|
|
|
<hr>
|
2020-07-13 16:42:55 +00:00
|
|
|
<$list filter="[<userInput>minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
|
|
|
|
<$list filter=<<systemTagsFilter>> variable="tag">
|
|
|
|
<$list filter="[<tag>addsuffix[-secondaryList]] -[<tagSelectionState>get[text]]" emptyMessage="""<$macrocall $name="tag-button" actions=<<__actions__>> selectedClass="tc-tag-button-selected"/>""">
|
2020-06-11 11:12:45 +00:00
|
|
|
<$macrocall $name="tag-button" actions=<<__actions__>>/>
|
2020-07-13 16:42:55 +00:00
|
|
|
</$list>
|
2018-04-02 18:43:18 +00:00
|
|
|
</$list></$list>
|
2019-10-14 13:31:57 +00:00
|
|
|
</$set>
|
2016-11-28 19:17:25 +00:00
|
|
|
</div>
|
|
|
|
</$reveal>
|
|
|
|
</div>
|
2020-06-11 11:12:45 +00:00
|
|
|
</div>
|
2020-07-13 16:42:55 +00:00
|
|
|
</$vars>
|
2016-11-28 19:17:25 +00:00
|
|
|
\end
|
2020-06-11 11:12:45 +00:00
|
|
|
\define tag-picker(actions)
|
2020-01-30 15:41:21 +00:00
|
|
|
\whitespace trim
|
2020-06-11 11:12:45 +00:00
|
|
|
<$list filter="[<newTagNameTiddler>match[]]" emptyMessage="""<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/>""">
|
2019-10-20 16:00:08 +00:00
|
|
|
<$set name="newTagNameTiddler" value=<<qualify "$:/temp/NewTagName">>>
|
2020-06-11 11:12:45 +00:00
|
|
|
<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/>
|
2019-10-20 16:00:08 +00:00
|
|
|
</$set>
|
|
|
|
</$list>
|
|
|
|
\end
|