mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Fix server error when saving a new tiddler created by following a tiddler link (#4770)
* Initialize draft tiddler with empty text Otherwise, when the tiddler has a meta file, $tw.utils.saveTiddlerToFile will call fs.writeFile with the content to write as `undefined`. Depending on the version of Node, this results in the string "undefined" getting saved or a TypeError. * Remove what seems to be a leftover debug log
This commit is contained in:
parent
aa08210e44
commit
259b45065a
@ -273,7 +273,9 @@ NavigatorWidget.prototype.makeDraftTiddler = function(targetTitle) {
|
||||
var tiddler = this.wiki.getTiddler(targetTitle);
|
||||
// Save the initial value of the draft tiddler
|
||||
draftTitle = this.generateDraftTitle(targetTitle);
|
||||
var draftTiddler = new $tw.Tiddler(
|
||||
var draftTiddler = new $tw.Tiddler({
|
||||
text: "",
|
||||
},
|
||||
tiddler,
|
||||
{
|
||||
title: draftTitle,
|
||||
@ -325,7 +327,6 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
|
||||
// If enabled, relink references to renamed tiddler
|
||||
var shouldRelink = this.getAttribute("relinkOnRename","no").toLowerCase().trim() === "yes";
|
||||
if(isRename && shouldRelink && this.wiki.tiddlerExists(draftOf)) {
|
||||
console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
|
||||
this.wiki.relinkTiddler(draftOf,draftTitle);
|
||||
}
|
||||
// Remove the draft tiddler
|
||||
|
Loading…
Reference in New Issue
Block a user