1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Navigator now sets variables for the story list and history list, that are available to child widgets. Needed in a mutiple-story tiddlywiki. (#2904)

This commit is contained in:
saqimtiaz 2017-06-29 09:36:20 +02:00 committed by Jeremy Ruston
parent 5892c4d8bc
commit 5d74513a97

View File

@ -60,6 +60,8 @@ NavigatorWidget.prototype.execute = function() {
// Get our parameters // Get our parameters
this.storyTitle = this.getAttribute("story"); this.storyTitle = this.getAttribute("story");
this.historyTitle = this.getAttribute("history"); this.historyTitle = this.getAttribute("history");
this.setVariable("tv-storylist",this.storyTitle);
this.setVariable("tv-historylist",this.historyTitle);
// Construct the child widgets // Construct the child widgets
this.makeChildWidgets(); this.makeChildWidgets();
}; };
@ -497,7 +499,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
storyList.splice(slot + 1,0,draftTitle); storyList.splice(slot + 1,0,draftTitle);
} }
if(storyList.indexOf(title) !== -1) { if(storyList.indexOf(title) !== -1) {
storyList.splice(storyList.indexOf(title),1); storyList.splice(storyList.indexOf(title),1);
} }
this.saveStoryList(storyList); this.saveStoryList(storyList);
// Add a new record to the top of the history stack // Add a new record to the top of the history stack
@ -510,7 +512,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
// Get the tiddlers // Get the tiddlers
var tiddlers = []; var tiddlers = [];
try { try {
tiddlers = JSON.parse(event.param); tiddlers = JSON.parse(event.param);
} catch(e) { } catch(e) {
} }
// Get the current $:/Import tiddler // Get the current $:/Import tiddler
@ -563,7 +565,7 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
return false; return false;
}; };
// //
NavigatorWidget.prototype.handlePerformImportEvent = function(event) { NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
var self = this, var self = this,
importTiddler = this.wiki.getTiddler(event.param), importTiddler = this.wiki.getTiddler(event.param),