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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ Compute the internal state of the widget
*/
DeleteFieldWidget.prototype.execute = function() {
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),
removeFields = {},
hasChanged = false;
if(this.actionField && tiddler) {
if((this.actionField !== null) && tiddler) {
removeFields[this.actionField] = undefined;
if(this.actionField in tiddler.fields) {
hasChanged = true;