1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-04-05 02:06:56 +00:00

Fix problem with new tiddler fields cascade

Fixes #2821

The problem was that an empty configured text field for new journals was overriding any value provided in the existing tiddler.
This commit is contained in:
Jermolene 2017-11-08 08:41:00 +00:00
parent ae8fb3e98b
commit 967b123b51

View File

@ -458,6 +458,13 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
if(additionalFields && additionalFields.title) {
title = additionalFields.title;
}
// Make a copy of the additional fields excluding any blank ones
var filteredAdditionalFields = $tw.utils.extend({},additionalFields);
Object.keys(filteredAdditionalFields).forEach(function(fieldName) {
if(filteredAdditionalFields[fieldName] === "") {
delete filteredAdditionalFields[fieldName];
}
});
// Generate a title if we don't have one
title = title || this.wiki.generateNewTitle($tw.language.getString("DefaultNewTiddlerTitle"));
// Find any existing draft for this tiddler
@ -488,8 +495,9 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
"draft.title": title
},
templateTiddler,
existingTiddler,
additionalFields,
existingTiddler,
filteredAdditionalFields,
this.wiki.getCreationFields(),
{
title: draftTitle,