From 967b123b51c06ab4e14470196f0a15064167a8f4 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 8 Nov 2017 08:41:00 +0000 Subject: [PATCH] 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. --- core/modules/widgets/navigator.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index db68d18dd..62ff11c29 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -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,