1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Fix 8347 tag-picker macro improve tagListFilter (#8351)

* improve tagListFiler defaults to [tags[]sort[]] now

* tag-picker - update docs
This commit is contained in:
Mario Pietsch 2024-07-09 21:55:51 +02:00 committed by GitHub
parent 5758d0b313
commit 906ac3817d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -1,9 +1,12 @@
title: $:/core/macros/tag-picker title: $:/core/macros/tag-picker
tags: $:/tags/Macro $:/tags/Global tags: $:/tags/Macro $:/tags/Global
first-search-filter: [subfilter<tagListFilter>!is[system]search:title<userInput>sort[]] first-search-filter: [subfilter<tagListFilter>!is[system]search:title<userInput>]
second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>sort[]] second-search-filter: [subfilter<tagListFilter>is[system]search:title<userInput>]
<!-- first-search-filter and second-search-filter fields are not used here in the code, but they are defined as parameters for keyboard-driven-input macro --> <!--
Fields: "first-search-filter", "second-search-filter" are assigned to the keyboard-driven input macro with parameter: "configTiddlerFilter"
They __need to be the same__ as used for variables: "nonSystemTagsFilter" and "systemTagsFilter". See code below!
-->
\whitespace trim \whitespace trim
@ -150,7 +153,7 @@ The second ESC tries to close the "draft tiddler"
\end \end
<!-- prepare all variables for tag-picker keyboard handling --> <!-- prepare all variables for tag-picker keyboard handling -->
\procedure tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]]") \procedure tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]sort[]]")
\function _tf.getUserInput() [<storeTitle>get[text]] \function _tf.getUserInput() [<storeTitle>get[text]]
\function _tf.getTag() [<newTagNameTiddler>get[text]] \function _tf.getTag() [<newTagNameTiddler>get[text]]
@ -158,6 +161,7 @@ The second ESC tries to close the "draft tiddler"
\function _tf.makeTagNameTiddler() [[$:/temp/NewTagName]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]] \function _tf.makeTagNameTiddler() [[$:/temp/NewTagName]] [<tagField>!match[tags]] +[join[/]] [<qualify>] +[join[]]
<!-- keep those variables because they may "bleed" into macros using old syntax --> <!-- keep those variables because they may "bleed" into macros using old syntax -->
<!-- "nonSystemTagsFilter", "systemTagsFilter" __need to be the same__ as fields: "first-search-filter", "second-search-filter" -->
<$let <$let
palette={{$:/palette}} palette={{$:/palette}}
colourA={{{ [<palette>getindex[foreground]] }}} colourA={{{ [<palette>getindex[foreground]] }}}
@ -174,8 +178,8 @@ The second ESC tries to close the "draft tiddler"
refreshTitle=<<qualify "$:/temp/NewTagName/refresh">> refreshTitle=<<qualify "$:/temp/NewTagName/refresh">>
nonSystemTagsFilter="[subfilter<tagListFilter>!is[system]search:title<userInput>sort[]]" nonSystemTagsFilter="[subfilter<tagListFilter>!is[system]search:title<userInput>]"
systemTagsFilter="[subfilter<tagListFilter>is[system]search:title<userInput>sort[]]" systemTagsFilter="[subfilter<tagListFilter>is[system]search:title<userInput>]"
cancelPopups="yes" cancelPopups="yes"
> >

View File

@ -1,6 +1,6 @@
caption: tag-picker caption: tag-picker
created: 20161128191316701 created: 20161128191316701
modified: 20230616114543787 modified: 20240708175550512
tags: Macros [[Core Macros]] tags: Macros [[Core Macros]]
title: tag-picker Macro title: tag-picker Macro
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -19,7 +19,8 @@ The <<.def tag-picker>> [[macro|Macros]] generates a combination of a text box a
: <<.from-version 5.3.4>> Defines the target tiddler, which should be manipulated. Defaults to: <<.var currentTiddler>>. : <<.from-version 5.3.4>> Defines the target tiddler, which should be manipulated. Defaults to: <<.var currentTiddler>>.
; tagListFilter ; tagListFilter
: <<.from-version 5.3.4>> 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: `[<listSource>get[field-name]enlist-input[]]`. : <<.from-version 5.3.4>> 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: `[<listSource>get[field-name]enlist-input[]]`. See examples.
: <<.from-version 5.3.6>> This parameter defaults to: `[tags[]sort[]]`. This change allows a custom sort order, since `sort[]` is not hardcoded into the tag-picker macro anymore.
<<.macro-examples "tag-picker">> <<.macro-examples "tag-picker">>