mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Fixes for navigation
This commit is contained in:
parent
e88da55683
commit
8d67bcb718
@ -112,7 +112,6 @@ exports.createListElement = function(title) {
|
||||
var node = this.createListElementMacro(title),
|
||||
eventHandler = {handleEvent: function(event) {
|
||||
// Add context information to the event
|
||||
event.navigateFromListElement = node;
|
||||
event.navigateFromTitle = title;
|
||||
return true;
|
||||
}};
|
||||
|
@ -47,21 +47,17 @@ exports.eventMap["tw-navigate"] = function(event) {
|
||||
var t,tiddler,slot;
|
||||
// See if the tiddler is already there
|
||||
for(t=0; t<this.story.length; t++) {
|
||||
if(this.story[t].title === event.navigateTo) {
|
||||
if(this.story[t] === event.navigateTo) {
|
||||
tiddler = t;
|
||||
}
|
||||
}
|
||||
// If not we need to add it
|
||||
if(tiddler === undefined) {
|
||||
// First we try to find the position of the story element we navigated from
|
||||
var navigateFromTitle;
|
||||
if(event.navigateFromStoryElement) {
|
||||
navigateFromTitle = event.navigateFromStoryElement.params.target;
|
||||
}
|
||||
slot = 0;
|
||||
if(navigateFromTitle !== undefined) {
|
||||
if(event.navigateFromTitle !== undefined) {
|
||||
for(t=0; t<this.story.length; t++) {
|
||||
if(this.story[t].title === navigateFromTitle) {
|
||||
if(this.story[t] === event.navigateFromTitle) {
|
||||
slot = t + 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user