mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 06:14:44 +00:00
Fix $timestamp ignored for action-setfield widget when setting index values
This commit is contained in:
parent
2f133a08aa
commit
8ae4428332
@ -81,7 +81,7 @@ exports.setText = function(title,field,index,value,options) {
|
|||||||
} else {
|
} else {
|
||||||
delete data[index];
|
delete data[index];
|
||||||
}
|
}
|
||||||
this.setTiddlerData(title,data,modificationFields);
|
this.setTiddlerData(title,data,{},{suppressTimestamp: options.suppressTimestamp});
|
||||||
} else {
|
} else {
|
||||||
var tiddler = this.getTiddler(title),
|
var tiddler = this.getTiddler(title),
|
||||||
fields = {title: title};
|
fields = {title: title};
|
||||||
@ -856,19 +856,24 @@ Set a tiddlers content to a JavaScript object. Currently this is done by setting
|
|||||||
title: title of tiddler
|
title: title of tiddler
|
||||||
data: object that can be serialised to JSON
|
data: object that can be serialised to JSON
|
||||||
fields: optional hashmap of additional tiddler fields to be set
|
fields: optional hashmap of additional tiddler fields to be set
|
||||||
|
options: optional hashmap of options including:
|
||||||
|
suppressTimestamp: if true, don't set the creation/modification timestamps
|
||||||
*/
|
*/
|
||||||
exports.setTiddlerData = function(title,data,fields) {
|
exports.setTiddlerData = function(title,data,fields,options) {
|
||||||
|
options = options || {};
|
||||||
var existingTiddler = this.getTiddler(title),
|
var existingTiddler = this.getTiddler(title),
|
||||||
|
creationFields = options.suppressTimestamp ? {} : this.getCreationFields(),
|
||||||
|
modificationFields = options.suppressTimestamp ? {} : this.getModificationFields(),
|
||||||
newFields = {
|
newFields = {
|
||||||
title: title
|
title: title
|
||||||
};
|
};
|
||||||
if(existingTiddler && existingTiddler.fields.type === "application/x-tiddler-dictionary") {
|
if(existingTiddler && existingTiddler.fields.type === "application/x-tiddler-dictionary") {
|
||||||
newFields.text = $tw.utils.makeTiddlerDictionary(data);
|
newFields.text = $tw.utils.makeTiddlerDictionary(data);
|
||||||
} else {
|
} else {
|
||||||
newFields.type = "application/json";
|
newFields.type = "application/json";
|
||||||
newFields.text = JSON.stringify(data,null,$tw.config.preferences.jsonSpaces);
|
newFields.text = JSON.stringify(data,null,$tw.config.preferences.jsonSpaces);
|
||||||
}
|
}
|
||||||
this.addTiddler(new $tw.Tiddler(this.getCreationFields(),existingTiddler,fields,newFields,this.getModificationFields()));
|
this.addTiddler(new $tw.Tiddler(creationFields,existingTiddler,fields,newFields,modificationFields));
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user