1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 06:13:17 +00:00

Add support for actions attribute to CheckboxWidget

This commit is contained in:
Jermolene 2016-11-26 08:21:58 +00:00
parent d1121787c0
commit 3bceb98119
2 changed files with 7 additions and 1 deletions

View File

@ -127,6 +127,10 @@ CheckboxWidget.prototype.handleChangeEvent = function(event) {
if(hasChanged) { if(hasChanged) {
this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields())); this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),fallbackFields,tiddler,newFields,this.wiki.getModificationFields()));
} }
// Trigger actions
if(this.checkboxActions) {
this.invokeActionString(this.checkboxActions,this,event);
}
}; };
/* /*
@ -134,6 +138,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.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");

View File

@ -1,6 +1,6 @@
caption: checkbox caption: checkbox
created: 20131024141900000 created: 20131024141900000
modified: 20150626091305445 modified: 20161126081845399
tags: Widgets tags: Widgets
title: CheckboxWidget title: CheckboxWidget
type: text/vnd.tiddlywiki type: text/vnd.tiddlywiki
@ -25,6 +25,7 @@ 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 |
!! Tag Mode !! Tag Mode