mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +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:
parent
a8bd22f363
commit
501ad2798f
|
@ -156,6 +156,9 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
|
||||||
if(this.checkboxActions) {
|
if(this.checkboxActions) {
|
||||||
this.invokeActionString(this.checkboxActions,this,event);
|
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() {
|
CheckboxWidget.prototype.execute = function() {
|
||||||
// Get the parameters from the attributes
|
// Get the parameters from the attributes
|
||||||
this.checkboxActions = this.getAttribute("actions");
|
this.checkboxActions = this.getAttribute("actions");
|
||||||
|
this.checkboxUncheckActions = this.getAttribute("uncheckactions");
|
||||||
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
this.checkboxTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler"));
|
||||||
this.checkboxTag = this.getAttribute("tag");
|
this.checkboxTag = this.getAttribute("tag");
|
||||||
this.checkboxField = this.getAttribute("field");
|
this.checkboxField = this.getAttribute("field");
|
||||||
|
@ -197,4 +201,4 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
|
|
||||||
exports.checkbox = CheckboxWidget;
|
exports.checkbox = CheckboxWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -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 |
|
|unchecked |The value of the field corresponding to the checkbox being unchecked |
|
||||||
|default |The default value to use if the field is not defined |
|
|default |The default value to use if the field is not defined |
|
||||||
|class |The class that will be assigned to the label element |
|
|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
|
!! Tag Mode
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user