1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 13:29:56 +00:00

Fix bug in reveal widget when stateTitle tiddler is missing (#3745)

in the group this bug was reported

when the stateTitle is missing it tries to get a field string of an undefined tiddler ...
This commit is contained in:
Simon Huber 2019-02-01 17:53:29 +01:00 committed by Jeremy Ruston
parent a4eb139f99
commit 4228c3f9cc

View File

@ -118,10 +118,21 @@ Read the state tiddler
*/ */
RevealWidget.prototype.readState = function() { RevealWidget.prototype.readState = function() {
// Read the information from the state tiddler // Read the information from the state tiddler
var state = this.stateTitle ? (this.stateField ? this.wiki.getTiddler(this.stateTitle).getFieldString(this.stateField) : var state;
(this.stateIndex ? this.wiki.extractTiddlerDataItem(this.stateTitle,this.stateIndex) : if(this.stateTitle) {
this.wiki.getTiddlerText(this.stateTitle))) || this["default"] || this.getVariable("currentTiddler") : var stateTitleTiddler = this.wiki.getTiddler(this.stateTitle);
(this.stateTiddlerTitle ? this.wiki.getTextReference(this.state,this["default"],this.getVariable("currentTiddler")) : this["default"]); if(this.stateField) {
state = stateTitleTiddler ? stateTitleTiddler.getFieldString(this.stateField) : this["default"] || this.getVariable("currentTiddler");
} else if(this.stateIndex) {
state = stateTitleTiddler ? this.wiki.extractTiddlerDataItem(this.stateTitle,this.stateIndex) : this["default"] || this.getVariable("currentTiddler");
} else if(stateTitleTiddler) {
state = this.wiki.getTiddlerText(this.stateTitle) || this["default"] || this.getVariable("currentTiddler");
} else {
state = this["default"] || this.getVariable("currentTiddler");
}
} else {
state = this.stateTiddlerTitle ? this.wiki.getTextReference(this.state,this["default"],this.getVariable("currentTiddler")) : this["default"];
}
if(state === null) { if(state === null) {
state = this["default"]; state = this["default"];
} }