mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 20:10:03 +00:00
Add 'default' attribute to button widget
This allows us to do things like tab controls properly.
This commit is contained in:
parent
8ab7a1dd8f
commit
ed6fd475ab
@ -79,7 +79,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
|
|
||||||
ButtonWidget.prototype.isSelected = function() {
|
ButtonWidget.prototype.isSelected = function() {
|
||||||
var tiddler = this.wiki.getTiddler(this.set);
|
var tiddler = this.wiki.getTiddler(this.set);
|
||||||
return tiddler ? tiddler.fields.text === this.setTo : false;
|
return tiddler ? tiddler.fields.text === this.setTo : this.defaultSetValue === this.setTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
ButtonWidget.prototype.isPoppedUp = function() {
|
ButtonWidget.prototype.isPoppedUp = function() {
|
||||||
@ -119,6 +119,7 @@ ButtonWidget.prototype.execute = function() {
|
|||||||
this["class"] = this.getAttribute("class","");
|
this["class"] = this.getAttribute("class","");
|
||||||
this.style = this.getAttribute("style");
|
this.style = this.getAttribute("style");
|
||||||
this.selectedClass = this.getAttribute("selectedClass");
|
this.selectedClass = this.getAttribute("selectedClass");
|
||||||
|
this.defaultSetValue = this.getAttribute("default");
|
||||||
// Make child widgets
|
// Make child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
};
|
};
|
||||||
|
@ -26,3 +26,4 @@ The content of the `<$button>` widget is displayed within the button.
|
|||||||
|class |An optional CSS class name to be assigned to the HTML element |
|
|class |An optional CSS class name to be assigned to the HTML element |
|
||||||
|style |An optional CSS style attribute to be assigned to the HTML element |
|
|style |An optional CSS style attribute to be assigned to the HTML element |
|
||||||
|selectedClass |An optional additional CSS class to be assigned if the popup is triggered or the tiddler specified in `set` already has the value specified in `setTo` |
|
|selectedClass |An optional additional CSS class to be assigned if the popup is triggered or the tiddler specified in `set` already has the value specified in `setTo` |
|
||||||
|
|default |Default value if `set` tiddler is missing for testing against `setTo` to determine `selectedClass` |
|
||||||
|
Loading…
Reference in New Issue
Block a user