mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Extend the info widget to return the current field
This commit is contained in:
parent
6f3f4528c9
commit
938124ca37
@ -20,12 +20,12 @@ var InfoWidget = function(renderer) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
InfoWidget.types = {
|
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() {
|
InfoWidget.prototype.generate = function() {
|
||||||
// Get attributes
|
// Get attributes
|
||||||
this.tiddlerTitle = this.renderer.getAttribute("tiddler",this.tiddlerTitle);
|
|
||||||
this.type = this.renderer.getAttribute("type","changecount");
|
this.type = this.renderer.getAttribute("type","changecount");
|
||||||
// Get the appropriate value for the current tiddler
|
// Get the appropriate value for the current tiddler
|
||||||
var value = "",
|
var value = "",
|
||||||
@ -33,7 +33,7 @@ InfoWidget.prototype.generate = function() {
|
|||||||
if(fn) {
|
if(fn) {
|
||||||
value = fn({
|
value = fn({
|
||||||
wiki: this.renderer.renderTree.wiki,
|
wiki: this.renderer.renderTree.wiki,
|
||||||
title: this.tiddlerTitle
|
widget: this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Set the element
|
// Set the element
|
||||||
|
Loading…
Reference in New Issue
Block a user