mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Remove dependency on wiki.js for story-startup and navigator (#4200)
* Update story.js * Update wiki.js * Update navigator.js * Add deprecation console logs to addToHistory and addToStory
This commit is contained in:
parent
70561bd481
commit
d5c4aa250a
@ -150,6 +150,11 @@ function openStartupTiddlers(options) {
|
||||
// Save the story list
|
||||
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
|
||||
// Update history
|
||||
var story = new $tw.Story({
|
||||
wiki: $tw.wiki,
|
||||
storyTitle: DEFAULT_STORY_TITLE,
|
||||
historyTitle: DEFAULT_HISTORY_TITLE
|
||||
});
|
||||
if(!options.disableHistory) {
|
||||
// If a target tiddler was specified add it to the history stack
|
||||
if(target && target !== "") {
|
||||
@ -157,9 +162,9 @@ function openStartupTiddlers(options) {
|
||||
if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") {
|
||||
target = target.substr(2,target.length - 4);
|
||||
}
|
||||
$tw.wiki.addToHistory(target);
|
||||
story.addToHistory(target);
|
||||
} else if(storyList.length > 0) {
|
||||
$tw.wiki.addToHistory(storyList[0]);
|
||||
story.addToHistory(storyList[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,11 @@ NavigatorWidget.prototype.execute = function() {
|
||||
this.historyTitle = this.getAttribute("history");
|
||||
this.setVariable("tv-story-list",this.storyTitle);
|
||||
this.setVariable("tv-history-list",this.historyTitle);
|
||||
this.story = new $tw.Story({
|
||||
wiki: this.wiki,
|
||||
storyTitle: this.storyTitle,
|
||||
historyTitle: this.historyTitle
|
||||
});
|
||||
// Construct the child widgets
|
||||
this.makeChildWidgets();
|
||||
};
|
||||
@ -123,7 +128,7 @@ NavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle
|
||||
|
||||
NavigatorWidget.prototype.addToStory = function(title,fromTitle) {
|
||||
if(this.storyTitle) {
|
||||
this.wiki.addToStory(title,fromTitle,this.storyTitle,{
|
||||
this.story.addToStory(title,fromTitle,this.storyTitle,{
|
||||
openLinkFromInsideRiver: this.getAttribute("openLinkFromInsideRiver","top"),
|
||||
openLinkFromOutsideRiver: this.getAttribute("openLinkFromOutsideRiver","top")
|
||||
});
|
||||
@ -136,7 +141,7 @@ title: a title string or an array of title strings
|
||||
fromPageRect: page coordinates of the origin of the navigation
|
||||
*/
|
||||
NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
|
||||
this.wiki.addToHistory(title,fromPageRect,this.historyTitle);
|
||||
this.story.addToHistory(title,fromPageRect,this.historyTitle);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1426,7 +1426,8 @@ historyTitle: title of history tiddler (defaults to $:/HistoryList)
|
||||
*/
|
||||
exports.addToHistory = function(title,fromPageRect,historyTitle) {
|
||||
var story = new $tw.Story({wiki: this, historyTitle: historyTitle});
|
||||
story.addToHistory(title,fromPageRect);
|
||||
story.addToHistory(title,fromPageRect);
|
||||
console.log("$tw.wiki.addToHistory() is deprecated since V5.1.23! Use the this.story.addToHistory() from the story-object!")
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1438,7 +1439,8 @@ options: see story.js
|
||||
*/
|
||||
exports.addToStory = function(title,fromTitle,storyTitle,options) {
|
||||
var story = new $tw.Story({wiki: this, storyTitle: storyTitle});
|
||||
story.addToStory(title,fromTitle,options);
|
||||
story.addToStory(title,fromTitle,options);
|
||||
console.log("$tw.wiki.addToStory() is deprecated since V5.1.23! Use the this.story.addToStory() from the story-object!")
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user