Extend the info widget to return the current field

print-window-tiddler
Jeremy Ruston 2013-06-02 23:20:24 +01:00
rodzic 6f3f4528c9
commit 938124ca37
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -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