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

Fix writing non-wikitext text tiddlers

The plan had been to switch template depending on the content type, but
we’d only implemented support for saving wikitext tiddlers. That meant
that creating a tiddler with any non-wikitext content type failed to
write the file correctly under Node.js.

Now we just always save in .tid file format.
This commit is contained in:
Jermolene 2016-07-14 17:42:57 +01:00
parent b357e8bb26
commit a4506231a7

View File

@ -40,10 +40,6 @@ $tw.config.typeInfo = {
}
};
$tw.config.typeTemplates = {
"application/x-tiddler": "$:/core/templates/tid-tiddler"
};
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
// See if we've already got information about this file
var self = this,
@ -178,8 +174,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
});
} else {
// Save the tiddler as a self contained templated file
template = $tw.config.typeTemplates[fileInfo.type];
content = self.wiki.renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
content = self.wiki.renderTiddler("text/plain","$:/core/templates/tid-tiddler",{variables: {currentTiddler: tiddler.fields.title}});
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
if(err) {
return callback(err);