mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-14 11:15:41 +00:00
$:/core/ui/EditTemplate/tags - rewrite to use v5.3.x syntax (#7981)
* $:/core/ui/EditTemplate/tags - rewrite to use v5.3.x syntax * tag-macro -- change tag-styles function to make it more readable * tags EditTemplate - improve code readability * tags EditTemplate -- use hardcoded style colours as requested
This commit is contained in:
parent
a09106f33b
commit
a21e7b2aac
@ -3,39 +3,63 @@ tags: $:/tags/EditTemplate
|
|||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
|
|
||||||
\define lingo-base() $:/language/EditTemplate/
|
\procedure lingo-base() $:/language/EditTemplate/
|
||||||
|
|
||||||
\define tag-styles()
|
\procedure tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:"tags")
|
||||||
background-color:$(backgroundColor)$;
|
<$wikify name="foregroundColor"
|
||||||
fill:$(foregroundColor)$;
|
text="""<$macrocall $name="contrastcolour"
|
||||||
color:$(foregroundColor)$;
|
target=<<colour>>
|
||||||
|
fallbackTarget=<<fallbackTarget>>
|
||||||
|
colourA=<<colourA>>
|
||||||
|
colourB=<<colourB>>/>
|
||||||
|
"""
|
||||||
|
>
|
||||||
|
<$let backgroundColor=<<colour>> >
|
||||||
|
<span class="tc-tag-label tc-tag-list-item tc-small-gap-right"
|
||||||
|
data-tag-title=<<currentTiddler>>
|
||||||
|
style.color=<<foregroundColor>>
|
||||||
|
style.fill=<<foregroundColor>>
|
||||||
|
style.background-color=<<backgroundColor>>
|
||||||
|
>
|
||||||
|
<$transclude tiddler=<<icon>>/>
|
||||||
|
<$view field="title" format="text"/>
|
||||||
|
<$button class="tc-btn-invisible tc-remove-tag-button"
|
||||||
|
style.fill=<<foregroundColor>>
|
||||||
|
>
|
||||||
|
<$action-listops $tiddler=<<saveTiddler>> $field=<<tagField>> $subfilter="-[{!!title}]"/>
|
||||||
|
{{$:/core/images/close-button}}
|
||||||
|
</$button>
|
||||||
|
</span>
|
||||||
|
</$let>
|
||||||
|
</$wikify>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define tag-body-inner(colour,fallbackTarget,colourA,colourB,icon,tagField:"tags")
|
\procedure tag-body(colour,palette,icon,tagField:"tags")
|
||||||
\whitespace trim
|
<$macrocall $name="tag-body-inner"
|
||||||
<$vars foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">> backgroundColor="""$colour$""">
|
colour=`$(colour)$`
|
||||||
<span style=<<tag-styles>> class="tc-tag-label tc-tag-list-item tc-small-gap-right" data-tag-title=<<currentTiddler>>>
|
colourA={{{ [<palette>getindex[foreground]] }}}
|
||||||
<$transclude tiddler="""$icon$"""/><$view field="title" format="text"/>
|
colourB={{{ [<palette>getindex[background]] }}}
|
||||||
<$button class="tc-btn-invisible tc-remove-tag-button" style=<<tag-styles>>><$action-listops $tiddler=<<saveTiddler>> $field=<<__tagField__>> $subfilter="-[{!!title}]"/>{{$:/core/images/close-button}}</$button>
|
fallbackTarget={{{ [<palette>getindex[tag-background]] }}}
|
||||||
</span>
|
icon=<<icon>>
|
||||||
</$vars>
|
tagField=<<tagField>>
|
||||||
|
/>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define tag-body(colour,palette,icon,tagField:"tags")
|
\procedure edit-tags-template(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
|
|
||||||
<div class="tc-edit-tags">
|
<div class="tc-edit-tags">
|
||||||
<$list filter="[list[!!$tagField$]sort[title]]" storyview="pop">
|
<$list filter="[<currentTiddler>get<tagField>enlist-input[]sort[title]]" storyview="pop">
|
||||||
<$macrocall $name="tag-body" colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}} palette={{$:/palette}} icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}} tagField=<<__tagField__>>/>
|
<$macrocall $name="tag-body"
|
||||||
</$list>
|
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
||||||
<$vars tabIndex={{$:/config/EditTabIndex}} cancelPopups="yes">
|
palette={{$:/palette}}
|
||||||
<$macrocall $name="tag-picker" tagField=<<__tagField__>>/>
|
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
||||||
</$vars>
|
tagField=<<tagField>>
|
||||||
|
/>
|
||||||
|
</$list>
|
||||||
|
<$let tabIndex={{$:/config/EditTabIndex}} cancelPopups="yes">
|
||||||
|
<$macrocall $name="tag-picker" tagField=<<tagField>>/>
|
||||||
|
</$let>
|
||||||
</div>
|
</div>
|
||||||
\end
|
\end
|
||||||
<$set name="saveTiddler" value=<<currentTiddler>>>
|
<$let saveTiddler=<<currentTiddler>>>
|
||||||
<$macrocall $name="edit-tags-template" tagField=<<tagField>>/>
|
<$macrocall $name="edit-tags-template" tagField=<<tagField>>/>
|
||||||
</$set>
|
</$let>
|
||||||
|
Loading…
Reference in New Issue
Block a user