mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-06 22:04:19 +00:00
Core: Allow startup navigation to be suppressed
Plugins can suppress it so that they can provide their own startup scroll handling
This commit is contained in:
parent
477c41f843
commit
348a0bc8bc
@ -36,7 +36,9 @@ var HELP_OPEN_EXTERNAL_WINDOW = "http://tiddlywiki.com/#WidgetMessage%3A%20tm-op
|
|||||||
|
|
||||||
exports.startup = function() {
|
exports.startup = function() {
|
||||||
// Open startup tiddlers
|
// Open startup tiddlers
|
||||||
openStartupTiddlers();
|
openStartupTiddlers({
|
||||||
|
disableHistory: $tw.boot.disableStartupNavigation
|
||||||
|
});
|
||||||
if($tw.browser) {
|
if($tw.browser) {
|
||||||
// Set up location hash update
|
// Set up location hash update
|
||||||
$tw.wiki.addEventListener("change",function(changes) {
|
$tw.wiki.addEventListener("change",function(changes) {
|
||||||
@ -106,6 +108,7 @@ exports.startup = function() {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Process the location hash to open the specified tiddlers. Options:
|
Process the location hash to open the specified tiddlers. Options:
|
||||||
|
disableHistory: if true $:/History is NOT updated
|
||||||
defaultToCurrentStory: If true, the current story is retained as the default, instead of opening the default tiddlers
|
defaultToCurrentStory: If true, the current story is retained as the default, instead of opening the default tiddlers
|
||||||
*/
|
*/
|
||||||
function openStartupTiddlers(options) {
|
function openStartupTiddlers(options) {
|
||||||
@ -146,6 +149,8 @@ function openStartupTiddlers(options) {
|
|||||||
}
|
}
|
||||||
// Save the story list
|
// Save the story list
|
||||||
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
|
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
|
||||||
|
// Update history
|
||||||
|
if(!options.disableHistory) {
|
||||||
// If a target tiddler was specified add it to the history stack
|
// If a target tiddler was specified add it to the history stack
|
||||||
if(target && target !== "") {
|
if(target && target !== "") {
|
||||||
// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present
|
// The target tiddler doesn't need double square brackets, but we'll silently remove them if they're present
|
||||||
@ -156,6 +161,7 @@ function openStartupTiddlers(options) {
|
|||||||
} else if(storyList.length > 0) {
|
} else if(storyList.length > 0) {
|
||||||
$tw.wiki.addToHistory(storyList[0]);
|
$tw.wiki.addToHistory(storyList[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user