1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-20 01:05:15 +00:00

Update actionsetfield widget to allow timestamp to be preserved

This commit is contained in:
Jermolene
2015-08-06 18:17:06 +01:00
parent 821617058d
commit e5cd8313a0
3 changed files with 14 additions and 7 deletions

View File

@@ -39,6 +39,7 @@ SetFieldWidget.prototype.execute = function() {
this.actionField = this.getAttribute("$field");
this.actionIndex = this.getAttribute("$index");
this.actionValue = this.getAttribute("$value");
this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes";
};
/*
@@ -57,13 +58,15 @@ SetFieldWidget.prototype.refresh = function(changedTiddlers) {
Invoke the action associated with this widget
*/
SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
var self = this;
var self = this,
options = {};
options.timestamp = this.actionTimestamp;
if(typeof this.actionValue === "string") {
this.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue);
this.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue,options);
}
$tw.utils.each(this.attributes,function(attribute,name) {
if(name.charAt(0) !== "$") {
self.wiki.setText(self.actionTiddler,name,undefined,attribute);
self.wiki.setText(self.actionTiddler,name,undefined,attribute,options);
}
});
return true; // Action was invoked