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); } };