diff --git a/core/wiki/macros/tag-picker.tid b/core/wiki/macros/tag-picker.tid index e1b1a713960..f3d0675c3d6 100644 --- a/core/wiki/macros/tag-picker.tid +++ b/core/wiki/macros/tag-picker.tid @@ -1,7 +1,9 @@ title: $:/core/macros/tag-picker tags: $:/tags/Macro -first-search-filter: [tags[]!is[system]search:titlesort[]] -second-search-filter: [tags[]is[system]search:titlesort[]] +first-search-filter: [subfilter!is[system]search:titlesort[]] +second-search-filter: [subfilteris[system]search:titlesort[]] + +\function tagpicker-dropdown-id() [] [[$(__tagField__)$-$(__tagListFilter__)$]substitute[]sha256[]] +[join[/]] \define get-tagpicker-focus-selector() [data-tiddler-title="$(currentTiddlerCSSEscaped)$"] .tc-add-tag-name input @@ -58,8 +60,8 @@ second-search-filter: [tags[]is[system]search:titlesort[]] > <$vars refreshTitle=<> - nonSystemTagsFilter="[tags[]!is[system]search:titlesort[]]" - systemTagsFilter="[tags[]is[system]search:titlesort[]]" + nonSystemTagsFilter="[subfilter!is[system]search:titlesort[]]" + systemTagsFilter="[subfilteris[system]search:titlesort[]]" >
@@ -74,7 +76,7 @@ second-search-filter: [tags[]is[system]search:titlesort[]] inputCancelActions=<> tag="input" placeholder={{$:/language/EditTemplate/Tags/Add/Placeholder}} - focusPopup=<> + focusPopup=<> class="tc-edit-texteditor tc-popup-handle" tabindex=<> focus={{{ [{$:/config/AutoFocus}match[tags]then[true]] ~[[false]] }}} @@ -83,7 +85,7 @@ second-search-filter: [tags[]is[system]search:titlesort[]] configTiddlerFilter="[[$:/core/macros/tag-picker]]" /> - <$button popup=<> + <$button popup=<> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Tags/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Tags/Dropdown/Caption}} @@ -112,7 +114,7 @@ second-search-filter: [tags[]is[system]search:titlesort[]]
- <$reveal state=<> type="nomatch" text="" default=""> + <$reveal state=<> type="nomatch" text="" default="">
<$set name="userInput" value={{{ [get[text]] }}}> <$list @@ -162,16 +164,17 @@ second-search-filter: [tags[]is[system]search:titlesort[]] \end -\define tag-picker(actions,tagField:"tags") +\define tag-picker(actions,tagField:"tags",tiddler,tagListFilter:"[tags[]]") \whitespace trim -<$vars saveTiddler=<> palette={{$:/palette}}> +\function targetTiddler() [<__tiddler__>is[blank]thenelse<__tiddler__>] +<$let saveTiddler=<> palette={{$:/palette}} tagListFilter=<<__tagListFilter__>>> <$list filter="[match[]]" emptyMessage="<$macrocall $name='tag-picker-inner' actions=<<__actions__>> tagField=<<__tagField__>>/>" > - <$set name="newTagNameTiddler" value=<>> + <$set name="newTagNameTiddler" value={{{ [[$:/temp/NewTagName]] [<__tagField__>!match[tags]] +[join[/]] [] +[join[]] }}}> <$macrocall $name="tag-picker-inner" actions=<<__actions__>> tagField=<<__tagField__>>/> - + \end diff --git a/editions/tw5.com/tiddlers/macros/examples/tag-picker Macro (Examples).tid b/editions/tw5.com/tiddlers/macros/examples/tag-picker Macro (Examples).tid new file mode 100644 index 00000000000..c65bfd9526f --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/tag-picker Macro (Examples).tid @@ -0,0 +1,42 @@ +created: 20230616104546608 +modified: 20230616141838664 +tags: [[tag-picker Macro]] [[Macro Examples]] +title: tag-picker Macro (Examples) +type: text/vnd.tiddlywiki + +<<.warning """The first example will set the tag of the <<.tid currentTiddler>> so you should copy / paste it to a new tiddler for testing. Otherwise you'll change "this tiddler" """>> + +<$macrocall $name=".example" n="1" +eg="""Use all existing tags and set the ''tags'' field here: <> +"""/> + + +<<.tip """The following examples use a temporary tiddler: $:/temp/test/tag-picker. So this tiddler will not be changed """>> + +<$let transclusion="test"> + +<$macrocall $name=".example" n="2" +eg="""$:/temp/test/tag-picker ''tags'': <$text text={{{ [[$:/temp/test/tag-picker]get[tags]enlist-input[]join[, ]else[n/a]] }}}/> + +Use all existing tags and set the $:/temp/test/tag-picker ''tags'' field: <> +"""/> + + +<$macrocall $name=".example" n="3" +eg="""$:/temp/test/tag-picker ''foo'': <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/> + +Use all existing tags and set the $:/temp/test/tag-picker ''foo'' field: <> +"""/> + + +<<.tip """The following example expects some values in the "foo" field of the tiddler $:/temp/test/tag-picker, which can be created by the example above.""">> + +<$macrocall $name=".example" n="4" eg="""\define listSource() $:/temp/test/tag-picker +$:/temp/test/tag-picker foo: <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/>
+$:/temp/test/tag-picker bar: <$text text={{{ [[$:/temp/test/tag-picker]get[bar]enlist-input[]join[, ]else[n/a]] }}}/> + +Use $:/temp/test/tag-picker ''foo'' field as source and set ''bar'': <get[foo]enlist-input[]]" tiddler:"$:/temp/test/tag-picker">> +"""/> + + + diff --git a/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid index bd67256c93b..a76c4877e52 100644 --- a/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid +++ b/editions/tw5.com/tiddlers/macros/tag-picker_Macro.tid @@ -1,6 +1,6 @@ caption: tag-picker created: 20161128191316701 -modified: 20161128191435641 +modified: 20230616114543787 tags: Macros [[Core Macros]] title: tag-picker Macro type: text/vnd.tiddlywiki @@ -9,9 +9,17 @@ The <<.def tag-picker>> [[macro|Macros]] generates a combination of a text box a !! Parameters -;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''. +; actions +: Action widgets to be triggered when the pill is clicked. Within the text, the variable <<.var tag>> contains the title of the selected tag. + +; tagField +: <<.from-version 5.1.23>> The specified ''field'' that gets updated with the selected tag. Defaults to `tags`. + +; tiddler +: <<.from-version 5.3.0>> Defines the target tiddler, which should be manipulated. Defaults to: <<.var currentTiddler>>. + +; tagListFilter +: <<.from-version 5.3.0>> This parameter defaults to: `[tags[]]` which creates a list of all existing tags. If the tag list should come from a different source the filter should look similar to eg: `[get[field-name]enlist-input[]]`. + <<.macro-examples "tag-picker">>