Fix removing a field with empty name (#6888)

* allow us to remove a field with empty key

* fix typo in if clause
This commit is contained in:
Mario Pietsch
2022-08-09 18:44:45 +02:00
committed by GitHub
parent d7b9e6fb02
commit 2ff5bd5a0f
+2 -2
View File
@@ -36,7 +36,7 @@ Compute the internal state of the widget
*/ */
DeleteFieldWidget.prototype.execute = function() { DeleteFieldWidget.prototype.execute = function() {
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler")); this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
this.actionField = this.getAttribute("$field"); this.actionField = this.getAttribute("$field",null);
}; };
/* /*
@@ -59,7 +59,7 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
tiddler = this.wiki.getTiddler(self.actionTiddler), tiddler = this.wiki.getTiddler(self.actionTiddler),
removeFields = {}, removeFields = {},
hasChanged = false; hasChanged = false;
if(this.actionField && tiddler) { if((this.actionField !== null) && tiddler) {
removeFields[this.actionField] = undefined; removeFields[this.actionField] = undefined;
if(this.actionField in tiddler.fields) { if(this.actionField in tiddler.fields) {
hasChanged = true; hasChanged = true;