1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 13:29:56 +00:00

Update navigator widget to use wiki.generateNewTitle()

This commit is contained in:
Jermolene 2013-12-20 16:53:49 +00:00
parent 274c52005d
commit 8538d69dc1

View File

@ -320,13 +320,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
// Get the template tiddler if there is one
var templateTiddler = this.wiki.getTiddler(event.param);
// Create the new tiddler
var baseTitle = (templateTiddler && templateTiddler.fields.title) || "New Tiddler",
title;
var t = 0,
title = baseTitle;
while (this.wiki.tiddlerExists(title)) {
title = baseTitle + " " + (++t);
}
var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || "New Tiddler");
var tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{
text: "Newly created tiddler",
title: title