1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-03 10:43:16 +00:00
TiddlyWiki5/core/wiki/macros/tag-picker.tid
Tobias Beer 15c7d24eaa Allows adding a new tag name by typing enter (#2592)
* allows to add a new tagname hitting enter

see: https://groups.google.com/forum/#!topic/tiddlywiki/wqQ8jPYG-X4

* revert changes to vanilla/base

* added "Special Keys" to KeyboardShortcuts

* added info to Creating and editing tiddlers

did not add current version of <<.from-version "5.1.14">>  because it
would interrupt the flow. When changed from a noisy "New in 5.1.14" to
"(new in 5.1.14)" we might add the version info here

* revert setText & added inline styles to vanilla base

* remove fieldmangler

* commit initial edittemplate tags to merge master

* ok, now really revert to initial edittemplate tags

* move add tag via enter into tag-picker macro(s)
2016-12-18 20:43:26 +00:00

49 lines
1.8 KiB
Plaintext

title: $:/core/macros/tag-picker
tags: $:/tags/Macro
\define add-tag-actions()
<$action-sendmessage $message="tm-add-tag" $param={{$:/temp/NewTagName}}/>
<$action-deletetiddler $tiddler="$:/temp/NewTagName"/>
\end
\define tag-button()
<$button class="tc-btn-invisible" tag="a">
$(actions)$
<$action-deletetiddler $tiddler="$:/temp/NewTagName"/>
<$macrocall $name="tag-pill" tag=<<tag>>/>
</$button>
\end
\define tag-picker(actions)
<$set name="actions" value="""$actions$""">
<div class="tc-edit-add-tag">
<span class="tc-add-tag-name">
<$keyboard key="ENTER" actions=<<add-tag-actions>>>
<$edit-text tiddler="$:/temp/NewTagName" tag="input" default="" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} focusPopup=<<qualify "$:/state/popup/tags-auto-complete">> class="tc-edit-texteditor tc-popup-handle"/>
</$keyboard>
</span> <$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> <span class="tc-add-tag-button">
<$set name="tag" value={{$:/temp/NewTagName}}>
<$button set="$:/temp/NewTagName" setTo="" class="">
$actions$
<$action-deletetiddler $tiddler="$:/temp/NewTagName"/>
{{$:/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="">
<div class="tc-block-dropdown">
<$list filter="[tags[]!is[system]search:title{$:/temp/NewTagName}sort[]]" variable="tag">
<<tag-button>>
</$list>
<hr>
<$list filter="[tags[]is[system]search:title{$:/temp/NewTagName}sort[]]" variable="tag">
<<tag-button>>
</$list>
</div>
</$reveal>
</div>
</$set>
\end