mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-01-20 19:41:32 -08:00
list-tagged-draggable to use title field by default (#9177)
* Revert the list-tagged-draggable to use title field by default * Update list.tid It seems `<$transclude field=<<__field__>> />` when field default value is empty does not work as expected. This commit uses `field:"title"` instead of `field:""` in the list-tagged-draggable header. * Update list.tid The redundant `field` removed. The new `displayField` attribute is used to let user choose the filed they like to display when the list items are rendered as simple links. * Update list.tid The proposed field attribute in list-tagged-draggable updated to use the same `displayField` aslist-links-draggable. * Create #9177 change note for #9177 was created * Update list.tid The `list-links-draggable` now is fully backward compatible. It uses caption as default field as before and is compatible with `list-links`. The `list-tagged-draggable` is fully backward compatible while got a new displayField parameter. * Update list-tagged-draggable Macro.tid Update docs to reflect new displayField parameter * Update list-links-draggable Macro.tid Update documentation to reflect the new displayField parameter. * Update list-tagged-draggable Macro.tid Update docs. Remove formatting error in doc.
This commit is contained in:
parent
f075f24e6b
commit
9663e65f4b
4 changed files with 27 additions and 3 deletions
|
|
@ -22,7 +22,7 @@ tags: $:/tags/Macro
|
|||
<$action-listops $tiddler=<<targetTiddler>> $field=<<targetField>> $subfilter="+[insertbefore<actionTiddler>,<currentTiddler>]"/>
|
||||
\end
|
||||
|
||||
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate)
|
||||
\define list-links-draggable(tiddler,field:"list",emptyMessage,type:"ul",subtype:"li",class:"",itemTemplate, displayField:"caption")
|
||||
\whitespace trim
|
||||
<$set name="_tiddler" value="""$tiddler$""" emptyValue=<<currentTiddler>> >
|
||||
<$let field-reference={{{ [<_tiddler>] "!!" [[$field$]] +[join[]] }}}
|
||||
|
|
@ -42,7 +42,7 @@ tags: $:/tags/Macro
|
|||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field="caption">
|
||||
<$transclude field=<<__displayField__>>>
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
|
|
@ -92,7 +92,7 @@ tags: $:/tags/Macro
|
|||
</$set>
|
||||
\end
|
||||
|
||||
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
|
||||
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"",displayField:"")
|
||||
\whitespace trim
|
||||
<span class="tc-tagged-draggable-list">
|
||||
<$set name="tag" value=<<__tag__>>>
|
||||
|
|
@ -110,6 +110,11 @@ tags: $:/tags/Macro
|
|||
<$genesis $type=<<__elementTag__>>>
|
||||
<$transclude tiddler="""$itemTemplate$""">
|
||||
<$link to={{!!title}}>
|
||||
<$let tv-wikilinks="no">
|
||||
<$transclude field=<<__displayField__>>>
|
||||
<$view field="title"/>
|
||||
</$transclude>
|
||||
</$let>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
</$transclude>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ The <<.def list-links-draggable>> [[macro|Macros]] renders the ListField of a ti
|
|||
; itemTemplate
|
||||
: Optional title of a tiddler to use as the template for rendering list items
|
||||
|
||||
;displayField
|
||||
: Optional name of the field to display when the list is rendered. Defaults to the "caption" field; if "caption" is not present, the "title" field is used instead
|
||||
|
||||
|
||||
If the `itemTemplate` parameter is not provided then the list items are rendered as simple links. Within the `itemTemplate`, the [[currentTiddler Variable]] refers to the current list item.
|
||||
|
||||
<<.macro-examples "list-links-draggable">>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ The <<.def list-tagged-draggable>> [[macro|Macros]] renders the tiddlers with a
|
|||
: Optional title of a tiddler to use as the template for rendering list items
|
||||
;emptyMessage
|
||||
: Optional wikitext to display if there are no tiddlers with the specified tag
|
||||
Here’s a corrected and polished version of your sentence in clear, standard English:
|
||||
;displayField
|
||||
: Optional name of the field to display when the list is rendered. Defaults to `title` field.
|
||||
|
||||
Note that the [[ordering|Order of Tagged Tiddlers]] is accomplished by assigning a new list to the `list` field of the tag tiddler. Any `list-before` or `list-after` fields on any of the other tiddlers carrying the tag are also removed to ensure the `list` field is respected.
|
||||
|
||||
|
|
|
|||
12
editions/tw5.com/tiddlers/releasenotes/5.4.0/#9177
Normal file
12
editions/tw5.com/tiddlers/releasenotes/5.4.0/#9177
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
title: $:/changenotes/5.4.0/#9177
|
||||
description: Add Display Field to list-tagged-draggable and list-links-draggable
|
||||
release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: enhancement
|
||||
change-category: usability
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9177
|
||||
github-contributors: kookma
|
||||
|
||||
A new input parameter, `displayField`, has been added to the `list-links-draggable` and `list-tagged-draggable` macros,
|
||||
allowing users to specify which field (e.g., title, caption, or any custom field) should be displayed when a tiddler is
|
||||
rendered via the draggable macro.
|
||||
Loading…
Add table
Add a link
Reference in a new issue