1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add 'default' attribute to button widget

This allows us to do things like tab controls properly.
This commit is contained in:
Jeremy Ruston 2013-11-04 09:59:26 +00:00
parent 8ab7a1dd8f
commit ed6fd475ab
2 changed files with 3 additions and 1 deletions

View File

@ -79,7 +79,7 @@ ButtonWidget.prototype.render = function(parent,nextSibling) {
ButtonWidget.prototype.isSelected = function() {
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() {
@ -119,6 +119,7 @@ ButtonWidget.prototype.execute = function() {
this["class"] = this.getAttribute("class","");
this.style = this.getAttribute("style");
this.selectedClass = this.getAttribute("selectedClass");
this.defaultSetValue = this.getAttribute("default");
// Make child widgets
this.makeChildWidgets();
};

View File

@ -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 |
|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` |
|default |Default value if `set` tiddler is missing for testing against `setTo` to determine `selectedClass` |