mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-09 15:26:33 +00:00
Simplify action-setfield widget
This commit is contained in:
parent
0a2a5184c4
commit
efeeab45f8
@ -57,21 +57,7 @@ SetFieldWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
Invoke the action associated with this widget
|
Invoke the action associated with this widget
|
||||||
*/
|
*/
|
||||||
SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
SetFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||||
var newFields = {};
|
this.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue);
|
||||||
if(this.actionIndex) {
|
|
||||||
var data = self.wiki.getTiddlerData(this.actionTiddler,{});
|
|
||||||
if(data[self.editIndex] !== value) {
|
|
||||||
data[self.editIndex] = value;
|
|
||||||
this.wiki.setTiddlerData(self.actionTiddler,data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var tiddler = this.wiki.getTiddler(this.actionTiddler),
|
|
||||||
updateFields = {
|
|
||||||
title: this.actionTiddler
|
|
||||||
};
|
|
||||||
updateFields[this.editField || "text"] = this.actionValue;
|
|
||||||
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,updateFields,this.wiki.getModificationFields()));
|
|
||||||
}
|
|
||||||
return true; // Action was invoked
|
return true; // Action was invoked
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user