mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-28 15:08:46 +00:00
Action-deletefield should only update tiddler modified/created if it is changed
This commit is contained in:
parent
5b3bb1974c
commit
c2391c5250
@ -57,18 +57,25 @@ Invoke the action associated with this widget
|
|||||||
DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||||
var self = this,
|
var self = this,
|
||||||
tiddler = this.wiki.getTiddler(self.actionTiddler),
|
tiddler = this.wiki.getTiddler(self.actionTiddler),
|
||||||
removeFields = {};
|
removeFields = {},
|
||||||
|
hasChanged = false;
|
||||||
if(this.actionField) {
|
if(this.actionField) {
|
||||||
removeFields[this.actionField] = undefined;
|
removeFields[this.actionField] = undefined;
|
||||||
|
if(this.actionField in tiddler.fields) {
|
||||||
|
hasChanged = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
$tw.utils.each(this.attributes,function(attribute,name) {
|
$tw.utils.each(this.attributes,function(attribute,name) {
|
||||||
if(name.charAt(0) !== "$" && name !== "title") {
|
if(name.charAt(0) !== "$" && name !== "title") {
|
||||||
removeFields[name] = undefined;
|
removeFields[name] = undefined;
|
||||||
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if(hasChanged) {
|
||||||
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
|
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true; // Action was invoked
|
return true; // Action was invoked
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user