1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Action-deletefield should only update tiddler modified/created if it is changed

This commit is contained in:
Jermolene 2017-03-19 19:30:52 +00:00
parent 5b3bb1974c
commit c2391c5250

View File

@ -57,17 +57,24 @@ Invoke the action associated with this widget
DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
var self = this,
tiddler = this.wiki.getTiddler(self.actionTiddler),
removeFields = {};
removeFields = {},
hasChanged = false;
if(this.actionField) {
removeFields[this.actionField] = undefined;
if(this.actionField in tiddler.fields) {
hasChanged = true;
}
}
if(tiddler) {
$tw.utils.each(this.attributes,function(attribute,name) {
if(name.charAt(0) !== "$" && name !== "title") {
removeFields[name] = undefined;
hasChanged = true;
}
});
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
if(hasChanged) {
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
}
}
return true; // Action was invoked
};