1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

SetWidget: Add "subtiddler" attribute

This commit is contained in:
Jermolene 2018-03-16 20:35:41 +00:00
parent b43ff430b7
commit 0d354fe57f
2 changed files with 9 additions and 2 deletions

View File

@ -42,6 +42,7 @@ SetWidget.prototype.execute = function() {
this.setFilter = this.getAttribute("filter");
this.setSelect = this.getAttribute("select");
this.setTiddler = this.getAttribute("tiddler");
this.setSubTiddler = this.getAttribute("subtiddler");
this.setField = this.getAttribute("field");
this.setIndex = this.getAttribute("index");
this.setValue = this.getAttribute("value");
@ -58,7 +59,12 @@ Get the value to be assigned
SetWidget.prototype.getValue = function() {
var value = this.setValue;
if(this.setTiddler) {
var tiddler = this.wiki.getTiddler(this.setTiddler);
var tiddler;
if(this.setSubTiddler) {
tiddler = this.wiki.getSubTiddler(this.setTiddler,this.setSubTiddler);
} else {
tiddler = this.wiki.getTiddler(this.setTiddler);
}
if(!tiddler) {
value = this.setEmptyValue;
} else if(this.setField) {

View File

@ -1,6 +1,6 @@
caption: set
created: 20131115182700000
modified: 20170712153850528
modified: 20180315165405442
tags: Widgets
title: SetWidget
type: text/vnd.tiddlywiki
@ -17,6 +17,7 @@ The content of the `<$set>` widget is the scope for the value assigned to the va
|name |The name of the variable to assign (defaults to "currentTiddler") |
|value |The value to assign to the variable if the filter is missing or not empty |
|tiddler |<<.from-version "5.1.15">> Optional title of the tiddler from which to read the value |
|subtiddler |<<.from-version "5.1.16">> Optionally specifies the title of a subtiddler within a plugin tiddler identified by the ''tiddler'' attribute |
|field |<<.from-version "5.1.15">> Optional field of the tiddler from which to read the value (only used if ''tiddler'' is used) |
|index |<<.from-version "5.1.15">> Optional index of the tiddler from which to read the value (only used if ''tiddler'' is used) |
|filter |An optional filter to be evaluated and assigned to the variable (see below) |