1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 06:43:15 +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() {
var tiddler = this.wiki.getTiddler(this.set);
this.wiki.addTiddler(new $tw.Tiddler(tiddler,{title: this.set, text: this.setTo}));
this.wiki.setTextReference(this.set,this.setTo,this.getVariable("currentTiddler"));
};
/*

View File

@ -1,6 +1,6 @@
title: ButtonWidget
created: 201310241419
modified: 201402220837
modified: 201403150837
tags: widget
! 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 |
|message |The name of the [[widget message|WidgetMessages]] to send when the button is clicked |
|param |The optional parameter to the message |
|set |The title of a tiddler to which a new value will be assigned |
|setTo |The new value to assign to the tiddler identified in the `set` attribute |
|set |A TextReference to which a new value will be assigned |
|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 |
|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 |