1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-04 17:16:18 +00:00

Update navigator.js

As described here: https://groups.google.com/d/msg/tiddlywikidev/AWvXz7RMIC4/gFF5crN2UJoJ

Providing a name for the new tiddler message only works if a skeleton tiddler already exists. If not, "New Tiddler" is taken. This change fixes that in that the provided name is taken even if there is no skeleton.
This commit is contained in:
Skeeve 2014-02-21 10:37:20 +01:00
parent 9b6c59e9a6
commit d5c31ed07f

View File

@ -323,10 +323,11 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
// Get the story details
var storyList = this.getStoryList();
var newTiddlerTitle = event.param || "New Tiddler";
// Get the template tiddler if there is one
var templateTiddler = this.wiki.getTiddler(event.param);
var templateTiddler = this.wiki.getTiddler(newTiddlerTitle);
// Create the new tiddler
var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || "New Tiddler");
var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || newTiddlerTitle);
var tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{
text: "Newly created tiddler",
title: title