1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-27 01:14:44 +00:00

Extend button widget to set text references

Previously the `set` attribute could only be used to identify a
tiddler, not a full text reference.
This commit is contained in:
Jermolene 2014-03-15 17:02:13 +00:00
parent afa677b9a0
commit f649b5b037
2 changed files with 4 additions and 5 deletions

View File

@ -118,8 +118,7 @@ ButtonWidget.prototype.triggerPopup = function(event) {
}; };
ButtonWidget.prototype.setTiddler = function() { ButtonWidget.prototype.setTiddler = function() {
var tiddler = this.wiki.getTiddler(this.set); this.wiki.setTextReference(this.set,this.setTo,this.getVariable("currentTiddler"));
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));
}; };
/* /*

View File

@ -1,6 +1,6 @@
title: ButtonWidget title: ButtonWidget
created: 201310241419 created: 201310241419
modified: 201402220837 modified: 201403150837
tags: widget tags: widget
! Introduction ! Introduction
@ -20,8 +20,8 @@ The content of the `<$button>` widget is displayed within the button.
|to |The title of the tiddler to navigate to | |to |The title of the tiddler to navigate to |
|message |The name of the [[widget message|WidgetMessages]] to send when the button is clicked | |message |The name of the [[widget message|WidgetMessages]] to send when the button is clicked |
|param |The optional parameter to the message | |param |The optional parameter to the message |
|set |The title of a tiddler to which a new value will be assigned | |set |A TextReference to which a new value will be assigned |
|setTo |The new value to assign to the tiddler identified in the `set` attribute | |setTo |The new value to assign to the TextReference identified in the `set` attribute |
|popup |Title of a state tiddler for a popup that is toggled when the button is clicked | |popup |Title of a state tiddler for a popup that is toggled when the button is clicked |
|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 |