1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Extend the info widget to return the current field

This commit is contained in:
Jeremy Ruston 2013-06-02 23:20:24 +01:00
parent 6f3f4528c9
commit 938124ca37

View File

@ -20,12 +20,12 @@ var InfoWidget = function(renderer) {
};
InfoWidget.types = {
changecount: function(options) {return options.wiki.getChangeCount(options.title);}
changecount: function(options) {return options.wiki.getChangeCount(options.widget.renderer.tiddlerTitle);},
currentField: function(options) {return options.widget.renderer.renderTree.getContextVariable(options.widget.renderer,"field","text");}
};
InfoWidget.prototype.generate = function() {
// Get attributes
this.tiddlerTitle = this.renderer.getAttribute("tiddler",this.tiddlerTitle);
this.type = this.renderer.getAttribute("type","changecount");
// Get the appropriate value for the current tiddler
var value = "",
@ -33,7 +33,7 @@ InfoWidget.prototype.generate = function() {
if(fn) {
value = fn({
wiki: this.renderer.renderTree.wiki,
title: this.tiddlerTitle
widget: this
});
}
// Set the element