1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-25 19:17:19 +00:00

make all list-* macros readable for easier future improvements (#7551)

* make all list-* widgets readable for easier future improvements

* remove whitespace on closing braces
This commit is contained in:
Mario Pietsch 2023-11-21 12:30:05 +01:00 committed by GitHub
parent 145a8d6992
commit a4850ba3d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,17 +4,17 @@ tags: $:/tags/Macro
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption") \define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage,field:"caption")
\whitespace trim \whitespace trim
<$genesis $type=<<__type__>> class=<<__class__>>> <$genesis $type=<<__type__>> class=<<__class__>>>
<$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>> <$list filter=<<__filter__>> emptyMessage=<<__emptyMessage__>>>
<$genesis $type=<<__subtype__>>> <$genesis $type=<<__subtype__>>>
<$link to={{!!title}}> <$link to={{!!title}}>
<$let tv-wikilinks="no"> <$let tv-wikilinks="no">
<$transclude field=<<__field__>>> <$transclude field=<<__field__>>>
<$view field="title"/> <$view field="title"/>
</$transclude> </$transclude>
</$let> </$let>
</$link> </$link>
</$genesis> </$genesis>
</$list> </$list>
</$genesis> </$genesis>
\end \end
@ -25,34 +25,42 @@ tags: $:/tags/Macro
\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)
\whitespace trim \whitespace trim
<span class="tc-links-draggable-list"> <span class="tc-links-draggable-list">
<$vars targetTiddler="""$tiddler$""" targetField="""$field$"""> <$vars targetTiddler="""$tiddler$""" targetField="""$field$""">
<$genesis $type=<<__type__>> class="$class$"> <$genesis $type=<<__type__>> class="$class$">
<$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>> <$list filter="[list[$tiddler$!!$field$]]" emptyMessage=<<__emptyMessage__>>>
<$droppable actions=<<list-links-draggable-drop-actions>> tag="""$subtype$""" enable=<<tv-enable-drag-and-drop>>> <$droppable
<div class="tc-droppable-placeholder"/> actions=<<list-links-draggable-drop-actions>>
<div> tag="""$subtype$"""
<$transclude tiddler="""$itemTemplate$"""> enable=<<tv-enable-drag-and-drop>>
<$link to={{!!title}}> >
<$let tv-wikilinks="no"> <div class="tc-droppable-placeholder"/>
<$transclude field="caption"> <div>
<$view field="title"/> <$transclude tiddler="""$itemTemplate$""">
</$transclude> <$link to={{!!title}}>
</$let> <$let tv-wikilinks="no">
</$link> <$transclude field="caption">
</$transclude> <$view field="title"/>
</div> </$transclude>
</$droppable> </$let>
</$list> </$link>
<$tiddler tiddler=""> </$transclude>
<$droppable actions=<<list-links-draggable-drop-actions>> tag="div" enable=<<tv-enable-drag-and-drop>>> </div>
<div class="tc-droppable-placeholder"> </$droppable>
{{$:/core/images/blank}} </$list>
</div> <$tiddler tiddler="">
<div style="height:0.5em;"/> <$droppable
</$droppable> actions=<<list-links-draggable-drop-actions>>
</$tiddler> tag="div"
</$genesis> enable=<<tv-enable-drag-and-drop>>
</$vars> >
<div class="tc-droppable-placeholder">
{{$:/core/images/blank}}
</div>
<div style="height:0.5em;"/>
</$droppable>
</$tiddler>
</$genesis>
</$vars>
</span> </span>
\end \end
@ -60,50 +68,59 @@ tags: $:/tags/Macro
\whitespace trim \whitespace trim
<!-- Save the current ordering of the tiddlers with this tag --> <!-- Save the current ordering of the tiddlers with this tag -->
<$set name="order" filter="[<__tag__>tagging[]]"> <$set name="order" filter="[<__tag__>tagging[]]">
<!-- Remove any list-after or list-before fields from the tiddlers with this tag --> <!-- Remove any list-after or list-before fields from the tiddlers with this tag -->
<$list filter="[<__tag__>tagging[]]"> <$list filter="[<__tag__>tagging[]]">
<$action-deletefield $field="list-before"/> <$action-deletefield $field="list-before"/>
<$action-deletefield $field="list-after"/> <$action-deletefield $field="list-after"/>
</$list> </$list>
<!-- Save the new order to the Tag Tiddler --> <!-- Save the new order to the Tag Tiddler -->
<$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/> <$action-listops $tiddler=<<__tag__>> $field="list" $filter="+[enlist<order>] +[insertbefore<actionTiddler>,<currentTiddler>]"/>
<!-- Make sure the newly added item has the right tag --> <!-- Make sure the newly added item has the right tag -->
<!-- Removing this line makes dragging tags within the dropdown work as intended --> <!-- Removing this line makes dragging tags within the dropdown work as intended -->
<!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>--> <!--<$action-listops $tiddler=<<actionTiddler>> $tags=<<__tag__>>/>-->
<!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag --> <!-- Using the following 5 lines as replacement makes dragging titles from outside into the dropdown apply the tag -->
<$list filter="[<actionTiddler>!contains:tags<__tag__>]"> <$list filter="[<actionTiddler>!contains:tags<__tag__>]">
<$fieldmangler tiddler=<<actionTiddler>>> <$fieldmangler tiddler=<<actionTiddler>>>
<$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/> <$action-sendmessage $message="tm-add-tag" $param=<<__tag__>>/>
</$fieldmangler> </$fieldmangler>
</$list> </$list>
</$set> </$set>
\end \end
\define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"") \define list-tagged-draggable(tag,subFilter,emptyMessage,itemTemplate,elementTag:"div",storyview:"")
\whitespace trim \whitespace trim
<span class="tc-tagged-draggable-list"> <span class="tc-tagged-draggable-list">
<$set name="tag" value=<<__tag__>>> <$set name="tag" value=<<__tag__>>>
<$list filter="[<__tag__>tagging[]$subFilter$]" emptyMessage=<<__emptyMessage__>> storyview=<<__storyview__>>> <$list
<$genesis $type=<<__elementTag__>> class="tc-menu-list-item"> filter="[<__tag__>tagging[]$subFilter$]"
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>> emptyMessage=<<__emptyMessage__>>
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/> storyview=<<__storyview__>>
<$genesis $type=<<__elementTag__>>> >
<$transclude tiddler="""$itemTemplate$"""> <$genesis $type=<<__elementTag__>> class="tc-menu-list-item">
<$link to={{!!title}}> <$droppable
<$view field="title"/> actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
</$link> enable=<<tv-enable-drag-and-drop>>
</$transclude> >
</$genesis> <$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
</$droppable> <$genesis $type=<<__elementTag__>>>
</$genesis> <$transclude tiddler="""$itemTemplate$""">
</$list> <$link to={{!!title}}>
<$tiddler tiddler=""> <$view field="title"/>
<$droppable actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>""" enable=<<tv-enable-drag-and-drop>>> </$link>
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/> </$transclude>
<$genesis $type=<<__elementTag__>> style="height:0.5em;"> </$genesis>
</$genesis> </$droppable>
</$droppable> </$genesis>
</$tiddler> </$list>
</$set> <$tiddler tiddler="">
<$droppable
actions="""<$macrocall $name="list-tagged-draggable-drop-actions" tag=<<__tag__>>/>"""
enable=<<tv-enable-drag-and-drop>>
>
<$genesis $type=<<__elementTag__>> class="tc-droppable-placeholder"/>
<$genesis $type=<<__elementTag__>> style="height:0.5em;"/>
</$droppable>
</$tiddler>
</$set>
</span> </span>
\end \end