diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index 4aaf83c4d..43f621901 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -26,8 +26,8 @@ caption: {{$:/language/ControlPanel/Basics/Caption}} |<$link to="$:/language/DefaultNewTiddlerTitle"><> |<$edit-text tiddler="$:/language/DefaultNewTiddlerTitle" default="" tag="input"/> | |<$link to="$:/config/NewJournal/Title"><> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> | |<$link to="$:/config/NewJournal/Text"><> |<$edit tiddler="$:/config/NewJournal/Text" tag="textarea" class="tc-edit-texteditor" default=""/> | -|<$link to="$:/config/NewTiddler/Tags"><> |<$edit-text tiddler="$:/config/NewTiddler/Tags" tag="input" default=""/> | -|<$link to="$:/config/NewJournal/Tags"><> |<$edit-text tiddler="$:/config/NewJournal/Tags" tag="input" default=""/> | +|<$link to="$:/config/NewTiddler/Tags"><> |<$vars currentTiddler="$:/config/NewTiddler/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}} | +|<$link to="$:/config/NewJournal/Tags"><> |<$vars currentTiddler="$:/config/NewJournal/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}} | |<$link to="$:/config/AutoFocus"><> |{{$:/snippets/minifocusswitcher}} | |<> |{{$:/snippets/minilanguageswitcher}} | |<> |<> | diff --git a/core/ui/EditTemplate/tags.tid b/core/ui/EditTemplate/tags.tid index 15d95d705..9548168a3 100644 --- a/core/ui/EditTemplate/tags.tid +++ b/core/ui/EditTemplate/tags.tid @@ -11,27 +11,33 @@ fill:$(foregroundColor)$; color:$(foregroundColor)$; \end -\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon) +\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:"tags") \whitespace trim <$vars foregroundColor=<> backgroundColor="""$colour$"""> > class="tc-tag-label tc-tag-list-item"> <$transclude tiddler="""$icon$"""/><$view field="title" format="text" /> -<$button message="tm-remove-tag" param={{!!title}} class="tc-btn-invisible tc-remove-tag-button">{{$:/core/images/close-button}} +<$button class="tc-btn-invisible tc-remove-tag-button"><$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="-[{!!title}]"/>{{$:/core/images/close-button}} \end -\define tag-body(colour,palette,icon) -<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} icon="""$icon$"""/> +\define tag-body(colour,palette,icon,tagField:"tags") +<$macrocall $name="tag-body-inner" colour="""$colour$""" fallbackTarget={{$palette$##tag-background}} colourA={{$palette$##foreground}} colourB={{$palette$##background}} icon="""$icon$""" tagField=<<__tagField__>>/> \end +\define edit-tags-template(tagField:"tags") +\whitespace trim
<$fieldmangler> -<$list filter="[all[current]tags[]sort[title]]" storyview="pop"> -<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}} icon={{!!icon}}/> +<$list filter="[list[!!$tagField$]sort[title]]" storyview="pop"> +<$macrocall $name="tag-body" colour={{!!color}} palette={{$:/palette}} icon={{!!icon}} tagField=<<__tagField__>>/> <$vars tabIndex={{$:/config/EditTabIndex}} cancelPopups="yes"> -<$macrocall $name="tag-picker"/> +<$macrocall $name="tag-picker" tagField=<<__tagField__>>/>
+\end +<$set name="saveTiddler" value=<>> +<$macrocall $name="edit-tags-template" tagField=<>/> + diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid index 9c17d3052..30e0fc8ab 100644 --- a/core/wiki/macros/tag-picker.tid +++ b/core/wiki/macros/tag-picker.tid @@ -7,12 +7,12 @@ second-search-filter: [tags[]is[system]search:titlesort[]] \define delete-tag-state-tiddlers() <$action-deletetiddler $filter="[] [] []"/> -\define add-tag-actions(actions) +\define add-tag-actions(actions,tagField:"tags") <$set name="tag" value={{{ [<__tiddler__>get[text]] }}}> -<$list filter="[!tag]" variable="ignore" emptyMessage=""" -<$action-sendmessage $message="tm-remove-tag" $param=<>/> +<$list filter="[!contains:$tagField$!match[]]" variable="ignore" emptyMessage=""" +<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="-[]"/> """> -<$action-sendmessage $message="tm-add-tag" $param=<>/> +<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[]"/> $actions$ @@ -20,10 +20,10 @@ $actions$ <$action-setfield $tiddler=<> text="yes"/> \end -\define tag-button(actions,selectedClass) +\define tag-button(actions,selectedClass,tagField:"tags") <$button class="tc-btn-invisible $selectedClass$" tag="a" tooltip={{$:/language/EditTemplate/Tags/Add/Button/Hint}}> -<$action-sendmessage $message="tm-add-tag" $param=<>/> -<$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> +<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[]"/> +<$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> <$action-sendmessage $message="tm-focus-selector" $param=<> preventScroll="true"/> <> @@ -47,14 +47,14 @@ $actions$ \end -\define tag-picker-inner(actions) +\define tag-picker-inner(actions,tagField:"tags") \whitespace trim <$vars tagSelectionState=<> storeTitle=<> refreshTitle=<> nonSystemTagsFilter="[tags[]!is[system]search:titlesort[]]" systemTagsFilter="[tags[]is[system]search:titlesort[]]">
<$macrocall $name="keyboard-driven-input" tiddler=<> storeTitle=<> refreshTitle=<> - selectionStateTitle=<> inputAcceptActions="""<$macrocall $name="add-tag-actions" actions=<<__actions__>>/>""" + selectionStateTitle=<> inputAcceptActions="""<$macrocall $name="add-tag-actions" actions=<<__actions__>> tagField=<<__tagField__>>/>""" 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}} @@ -62,9 +62,9 @@ $actions$ <$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}}<$reveal state=<> type="nomatch" text=""><$button 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}}<> <$set name="tag" value={{{ [get[text]] }}}> <$button set=<> setTo="" class=""> -<$action-sendmessage $message="tm-add-tag" $param=<>/> +<$action-listops $tiddler=<> $field=<<__tagField__>> $subfilter="[]"/> $actions$ -<$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> +<$set name="currentTiddlerCSSEscaped" value={{{ [escapecss[]] }}}> <><$action-sendmessage $message="tm-focus-selector" $param=<>/> {{$:/language/EditTemplate/Tags/Add/Button}} @@ -79,14 +79,14 @@ $actions$ <$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""
{{$:/language/Search/Search/TooShort}}
""" variable="listItem"> <$list filter=<> variable="tag"> <$list filter="[addsuffix[-primaryList]] -[get[text]]" emptyMessage="""<$macrocall $name="tag-button" actions=<<__actions__>> selectedClass="tc-tag-button-selected"/>"""> -<$macrocall $name="tag-button" actions=<<__actions__>>/> +<$macrocall $name="tag-button" actions=<<__actions__>> tagField=<<__tagField__>>/>
<$list filter="[minlength{$:/config/Tags/MinLength}limit[1]]" emptyMessage="""
{{$:/language/Search/Search/TooShort}}
""" variable="listItem"> <$list filter=<> variable="tag"> <$list filter="[addsuffix[-secondaryList]] -[get[text]]" emptyMessage="""<$macrocall $name="tag-button" actions=<<__actions__>> selectedClass="tc-tag-button-selected"/>"""> -<$macrocall $name="tag-button" actions=<<__actions__>>/> +<$macrocall $name="tag-button" actions=<<__actions__>> tagField=<<__tagField__>>/> @@ -96,11 +96,13 @@ $actions$
\end -\define tag-picker(actions) +\define tag-picker(actions,tagField:"tags") \whitespace trim -<$list filter="[match[]]" emptyMessage="""<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/>"""> +<$set name="saveTiddler" value=<>> +<$list filter="[match[]]" emptyMessage="""<$macrocall $name="tag-picker-inner" actions=<<__actions__>> tagField=<<__tagField__>>/>"""> <$set name="newTagNameTiddler" value=<>> -<$macrocall $name="tag-picker-inner" actions=<<__actions__>>/> +<$macrocall $name="tag-picker-inner" actions=<<__actions__>> tagField=<<__tagField__>>/> + \end diff --git a/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid index b2d9cb9f0..bd67256c9 100644 --- a/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid +++ b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid @@ -11,5 +11,7 @@ The <<.def tag-picker>> [[macro|Macros]] generates a combination of a text box a ;actions : Action widgets to be triggered when the pill is clicked. Within the text, the variable ''tag'' contains the title of the selected tag. +;tagField +: <<.from-version 5.1.23>> The ''field'' that gets updated with the selected tag. Defaults to ''tags''. <<.macro-examples "tag-picker">>