From a1ce254e95fea897cc772bf6477920c427477744 Mon Sep 17 00:00:00 2001 From: Tobias Beer Date: Mon, 21 Sep 2015 17:24:26 +0200 Subject: [PATCH] =?UTF-8?q?fixes=20#1937=20=E2=80=94=20filter=20refresh=20?= =?UTF-8?q?in=20set=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit as per @EvanBalster --- core/modules/widgets/setvariable.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/modules/widgets/setvariable.js b/core/modules/widgets/setvariable.js index e319a61e3..a3057356d 100755 --- a/core/modules/widgets/setvariable.js +++ b/core/modules/widgets/setvariable.js @@ -43,6 +43,15 @@ SetWidget.prototype.execute = function() { this.setValue = this.getAttribute("value"); this.setEmptyValue = this.getAttribute("emptyValue"); // Set context variable + this.setVariable(this.setName,this.getValue(),this.parseTreeNode.params); + // Construct the child widgets + this.makeChildWidgets(); +}; + +/* +Get the value to be assigned +*/ +SetWidget.prototype.getValue = function() { var value = this.setValue; if(this.setFilter) { var results = this.wiki.filterTiddlers(this.setFilter,this); @@ -53,9 +62,7 @@ SetWidget.prototype.execute = function() { value = this.setEmptyValue; } } - this.setVariable(this.setName,value,this.parseTreeNode.params); - // Construct the child widgets - this.makeChildWidgets(); + return value; }; /* @@ -63,11 +70,12 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of */ SetWidget.prototype.refresh = function(changedTiddlers) { var changedAttributes = this.computeAttributes(); - if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue) { + if(changedAttributes.name || changedAttributes.filter || changedAttributes.value || changedAttributes.emptyValue || + (this.setFilter && this.getValue() != this.variables[this.setName].value)) { this.refreshSelf(); return true; } else { - return this.refreshChildren(changedTiddlers); + return this.refreshChildren(changedTiddlers); } };