mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-22 23:16:53 +00:00
Ensure that tiddler manipulations affect the history
Previously edit tiddler etc wouldn’t actually navigate to the new tiddler
This commit is contained in:
parent
409311b61e
commit
b8897f86fb
@ -89,6 +89,18 @@ NavigatorWidget.prototype.findTitleInStory = function(title,defaultIndex) {
|
|||||||
return defaultIndex;
|
return defaultIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add a new record to the top of the history stack
|
||||||
|
*/
|
||||||
|
NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
|
||||||
|
// Add a new record to the top of the history stack
|
||||||
|
if(this.historyTitle) {
|
||||||
|
var historyList = this.wiki.getTiddlerData(this.historyTitle,[]);
|
||||||
|
historyList.push({title: title, fromPageRect: fromPageRect});
|
||||||
|
this.wiki.setTiddlerData(this.historyTitle,historyList);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handle a tw-navigate event
|
Handle a tw-navigate event
|
||||||
*/
|
*/
|
||||||
@ -108,12 +120,7 @@ NavigatorWidget.prototype.handleNavigateEvent = function(event) {
|
|||||||
this.saveStoryList();
|
this.saveStoryList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add a new record to the top of the history stack
|
this.addToHistory(event.navigateTo,event.navigateFromClientRect);
|
||||||
if(this.historyTitle) {
|
|
||||||
var historyList = this.wiki.getTiddlerData(this.historyTitle,[]);
|
|
||||||
historyList.push({title: event.navigateTo, fromPageRect: event.navigateFromClientRect});
|
|
||||||
this.wiki.setTiddlerData(this.historyTitle,historyList);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -163,6 +170,7 @@ NavigatorWidget.prototype.handleEditTiddlerEvent = function(event) {
|
|||||||
this.storyList.splice(t,1);
|
this.storyList.splice(t,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.addToHistory(draftTiddler.fields.title,event.navigateFromClientRect);
|
||||||
this.saveStoryList();
|
this.saveStoryList();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -270,6 +278,7 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
|
|||||||
if(draftTitle === this.storyTitle) {
|
if(draftTitle === this.storyTitle) {
|
||||||
storyTiddlerModified = true;
|
storyTiddlerModified = true;
|
||||||
}
|
}
|
||||||
|
this.addToHistory(draftTitle,event.navigateFromClientRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,6 +309,7 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
|
|||||||
storyTiddlerModified = true;
|
storyTiddlerModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.addToHistory(originalTitle,event.navigateFromClientRect);
|
||||||
}
|
}
|
||||||
if(storyTiddlerModified) {
|
if(storyTiddlerModified) {
|
||||||
this.saveStoryList();
|
this.saveStoryList();
|
||||||
@ -343,9 +353,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
|
|||||||
// Save the updated story
|
// Save the updated story
|
||||||
this.saveStoryList();
|
this.saveStoryList();
|
||||||
// Add a new record to the top of the history stack
|
// Add a new record to the top of the history stack
|
||||||
var history = this.wiki.getTiddlerData(this.historyTitle,[]);
|
this.addToHistory(draftTitle);
|
||||||
history.push({title: draftTitle});
|
|
||||||
this.wiki.setTiddlerData(this.historyTitle,history);
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user