1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Add ability to trigger actions on unchecking checkbox widget (#3182)

* Add uncheck-actions to checkbox widget

* Update checkbox.js

* Docs for "uncheckactions" param of checkbox widget
This commit is contained in:
Rizwan 2018-04-03 00:09:59 +05:30 committed by Jeremy Ruston
parent a8bd22f363
commit 501ad2798f
2 changed files with 7 additions and 2 deletions

View File

@ -156,6 +156,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
if(this.checkboxActions) {
this.invokeActionString(this.checkboxActions,this,event);
}
if(this.checkboxUncheckActions && !checked) {
this.invokeActionString(this.checkboxUncheckActions,this,event);
}
};
/*
@ -164,6 +167,7 @@ Compute the internal state of the widget
CheckboxWidget.prototype.execute = function() {
// Get the parameters from the attributes
this.checkboxActions = this.getAttribute("actions");
this.checkboxUncheckActions = this.getAttribute("uncheckactions");
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
this.checkboxTag = this.getAttribute("tag");
this.checkboxField = this.getAttribute("field");
@ -197,4 +201,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
exports.checkbox = CheckboxWidget;
})();
})();

View File

@ -26,7 +26,8 @@ The content of the `<$checkbox>` widget is displayed within an HTML `<label>` el
|unchecked |The value of the field corresponding to the checkbox being unchecked |
|default |The default value to use if the field is not defined |
|class |The class that will be assigned to the label element |
|actions |<<.from-version "5.1.14">> A string containing ActionWidgets to be triggered when the checkbox is clicked |
|actions |<<.from-version "5.1.14">> A string containing ActionWidgets to be triggered when the checkbox is checked |
|uncheckactions |<<.from-version "5.1.16">> A string containing ActionWidgets to be triggered when the checkbox is unchecked |
!! Tag Mode