1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Fix #4673 - Adding tags in $:/Manager does not work (#4674)

* Add fieldmangler to Manager Tags-Sidebar

This makes the tm-add-tag messages in the tag-picker work

* Add actions parameter back to tag-picker macro

* Add div so that tag-dropdown shows below input field

* Add missing tc-btn-dropdown class to dropdown button ...

... for consistency with dropdown buttons in EditTemplate

* Update tag-picker.tid
This commit is contained in:
Simon Huber 2020-06-11 13:12:45 +02:00 committed by GitHub
parent 25f8b3f903
commit b191ee9210
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 18 deletions

View File

@ -11,11 +11,6 @@ caption: {{$:/language/Manager/Item/Tags}}
\define tag-picker-actions()
<<tag-checkbox-actions>>
<$action-listops
$tiddler=<<currentTiddler>>
$field="tags"
$subfilter="[<tag>] [all[current]tags[]]"
/>
\end
<p>
@ -28,5 +23,7 @@ caption: {{$:/language/Manager/Item/Tags}}
</$list>
</p>
<p>
<$fieldmangler>
<$macrocall $name="tag-picker" actions=<<tag-picker-actions>>/>
</$fieldmangler>
</p>

View File

@ -1,30 +1,35 @@
title: $:/core/macros/tag-picker
tags: $:/tags/Macro
\define add-tag-actions()
<$action-sendmessage $message="tm-add-tag" $param={{{ [<newTagNameTiddler>get[text]] }}}/>
\define add-tag-actions(actions)
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
<$action-deletetiddler $tiddler=<<newTagNameTiddler>>/>
$actions$
</$set>
\end
\define tag-button()
\define tag-button(actions)
<$button class="tc-btn-invisible" tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}>
<$action-sendmessage $message="tm-add-tag" $param=<<tag>>/>
<$action-deletetiddler $tiddler=<<newTagNameTiddler>>/>
$actions$
<$macrocall $name="tag-pill" tag=<<tag>>/>
</$button>
\end
\define tag-picker-inner()
\define tag-picker-inner(actions)
\whitespace trim
<div class="tc-edit-add-tag">
<div>
<span class="tc-add-tag-name">
<$keyboard key="ENTER" actions=<<add-tag-actions>>>
<$edit-text tiddler=<<newTagNameTiddler>> tag="input" default="" 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]] }}} cancelPopups=<<cancelPopups>>/>
<$keyboard key="ENTER" actions="""<$macrocall $name="add-tag-actions" actions=<<__actions__>>/>""">
<$edit-text tiddler=<<newTagNameTiddler>> tag="input" default="" 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]] }}} cancelPopups="yes"/>
</$keyboard>
</span>&nbsp;<$button popup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>&nbsp;<span class="tc-add-tag-button">
</span>&nbsp;<$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>&nbsp;<span class="tc-add-tag-button">
<$set name="tag" value={{{ [<newTagNameTiddler>get[text]] }}}>
<$button set="$:/temp/NewTagName" setTo="" class="">
<<add-tag-actions>>
<$macrocall $name="add-tag-actions" actions=<<__actions__>>/>
<$action-deletetiddler $tiddler=<<newTagNameTiddler>>/>
{{$:/language/EditTemplate/Tags/Add/Button}}
</$button>
@ -37,23 +42,24 @@ tags: $:/tags/Macro
<$set name="newTagName" value={{{ [<newTagNameTiddler>get[text]] }}}>
<$list filter="[<newTagName>minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$list filter="[tags[]!is[system]search:title<newTagName>sort[]]" variable="tag">
<<tag-button>>
<$macrocall $name="tag-button" actions=<<__actions__>>/>
</$list></$list>
<hr>
<$list filter="[<newTagName>minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$list filter="[tags[]is[system]search:title<newTagName>sort[]]" variable="tag">
<<tag-button>>
<$macrocall $name="tag-button" actions=<<__actions__>>/>
</$list></$list>
</$set>
</div>
</$reveal>
</div>
</div>
\end
\define tag-picker()
\define tag-picker(actions)
\whitespace trim
<$list filter="[<newTagNameTiddler>match[]]" emptyMessage=<<tag-picker-inner>>>
<$list filter="[<newTagNameTiddler>match[]]" emptyMessage="""<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/>""">
<$set name="newTagNameTiddler" value=<<qualify "$:/temp/NewTagName">>>
<<tag-picker-inner>>
<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/>
</$set>
</$list>
\end