1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-24 02:27:19 +00:00

Fixes for the new tiddler button

This commit is contained in:
Jeremy Ruston 2012-10-24 22:39:37 +01:00
parent f623515b1c
commit e88da55683

View File

@ -161,7 +161,7 @@ exports.eventMap["tw-SaveTiddler"] = function(event) {
// Create a new draft tiddler // Create a new draft tiddler
exports.eventMap["tw-NewTiddler"] = function(event) { exports.eventMap["tw-NewTiddler"] = function(event) {
// Get the story details // Get the story details
this.getStory(); this.story = this.getList(this.storyTitle);
// Create the new tiddler // Create the new tiddler
for(var t=0; true; t++) { for(var t=0; true; t++) {
var title = "New Tiddler" + (t ? " " + t : ""); var title = "New Tiddler" + (t ? " " + t : "");
@ -184,28 +184,13 @@ exports.eventMap["tw-NewTiddler"] = function(event) {
}); });
this.wiki.addTiddler(draftTiddler); this.wiki.addTiddler(draftTiddler);
// Update the story to put the new draft at the top // Update the story to put the new draft at the top
this.story.tiddlers.splice(0,0,{ this.story.splice(0,0,draftTitle);
title: title,
draft: draftTitle
});
// Save the updated story // Save the updated story
this.saveStory(); this.saveList(this.storyTitle,this.story);
// Add a new record to the top of the history stack // Add a new record to the top of the history stack
this.getHistory(); this.history = this.getList(this.historyTitle);
this.history.stack.push({ this.history.push(draftTitle);
title: title, this.saveList(this.historyTitle,this.history);
fromTitle: "HelloThere",
fromPosition: {
top: 0,
left: 0,
right: 100,
bottom: 100,
width: 100,
height: 100
},
scrollPosition: $tw.utils.getScrollPosition()
});
this.saveHistory();
event.stopPropagation(); event.stopPropagation();
return false; return false;
}; };