mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-06 22:04:19 +00:00
Set the colour of the tag pills
We no longer need the old setstyle widget
This commit is contained in:
parent
0e037e3c5b
commit
707024a118
@ -46,6 +46,8 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
domNode.className = classes.join(" ");
|
domNode.className = classes.join(" ");
|
||||||
|
// Assign classes
|
||||||
|
domNode.setAttribute("style",this.style);
|
||||||
// Add a click event handler
|
// Add a click event handler
|
||||||
domNode.addEventListener("click",function (event) {
|
domNode.addEventListener("click",function (event) {
|
||||||
var handled = false;
|
var handled = false;
|
||||||
@ -114,6 +116,7 @@ ButtonWidget.prototype.execute = function() {
|
|||||||
this.hover = this.getAttribute("hover");
|
this.hover = this.getAttribute("hover");
|
||||||
this.qualifyTiddlerTitles = this.getAttribute("qualifyTiddlerTitles");
|
this.qualifyTiddlerTitles = this.getAttribute("qualifyTiddlerTitles");
|
||||||
this["class"] = this.getAttribute("class","");
|
this["class"] = this.getAttribute("class","");
|
||||||
|
this.style = this.getAttribute("style");
|
||||||
this.selectedClass = this.getAttribute("selectedClass");
|
this.selectedClass = this.getAttribute("selectedClass");
|
||||||
// Qualify tiddler titles if required
|
// Qualify tiddler titles if required
|
||||||
if(this.qualifyTiddlerTitles) {
|
if(this.qualifyTiddlerTitles) {
|
||||||
@ -134,7 +137,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
|||||||
*/
|
*/
|
||||||
ButtonWidget.prototype.refresh = function(changedTiddlers) {
|
ButtonWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.qualifyTiddlerTitles || changedAttributes["class"] || changedAttributes.selectedClass || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) {
|
if(changedAttributes.message || changedAttributes.param || changedAttributes.set || changedAttributes.setTo || changedAttributes.popup || changedAttributes.hover || changedAttributes.qualifyTiddlerTitles || changedAttributes["class"] || changedAttributes.selectedClass || changedAttributes.style || (this.set && changedTiddlers[this.set]) || (this.popup && changedTiddlers[this.popup])) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
title: $:/core/ui/TagTemplate
|
title: $:/core/ui/TagTemplate
|
||||||
|
|
||||||
<$button popup="$:/state/tagpopup" qualifyTiddlerTitles="yes" class="btn-invisible"><$setstyle name="background-color" value={{!!color}} class="tw-tag-label"><$transclude title={{!!icon}}/> <$view field="title" format="text" /></$setstyle></$button>
|
\define tag-styles()
|
||||||
|
background-color:$(backgroundColor)$;
|
||||||
|
\end
|
||||||
|
<$setvariable name="backgroundColor" value={{!!color}}><$button popup="$:/state/tagpopup" qualifyTiddlerTitles="yes" class="btn-invisible tw-tag-label" style=<<tag-styles>>><$transclude title={{!!icon}}/> <$view field="title" format="text" /></$button></$setvariable>
|
||||||
<$reveal state="$:/state/tagpopup" type="popup" position="below" qualifyTiddlerTitles="yes" ><div class="tw-drop-down">
|
<$reveal state="$:/state/tagpopup" type="popup" position="below" qualifyTiddlerTitles="yes" ><div class="tw-drop-down">
|
||||||
<$view field="title" format="link" />
|
<$view field="title" format="link" />
|
||||||
----
|
----
|
||||||
|
Loading…
x
Reference in New Issue
Block a user