mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +00:00
Set default title for tiddler files without metadata
This commit is contained in:
parent
6c42f38b9b
commit
66cdd8a639
@ -143,16 +143,22 @@ $tw.plugins.dropbox.loadTiddlerFile = function(path,mimeType,stats,callback) {
|
|||||||
callback(error);
|
callback(error);
|
||||||
return $tw.plugins.dropbox.showError(error);
|
return $tw.plugins.dropbox.showError(error);
|
||||||
}
|
}
|
||||||
|
// Compute the default title
|
||||||
|
var defaultTitle = path,
|
||||||
|
p = path.lastIndexOf("/");
|
||||||
|
if(p !== -1) {
|
||||||
|
defaultTitle = path.substr(p+1);
|
||||||
|
}
|
||||||
// Deserialise the tiddler(s) out of the text
|
// Deserialise the tiddler(s) out of the text
|
||||||
var tiddlers;
|
var tiddlers;
|
||||||
if(isBinary) {
|
if(isBinary) {
|
||||||
tiddlers = [{
|
tiddlers = [{
|
||||||
title: path,
|
title: defaultTitle,
|
||||||
text: $tw.plugins.dropbox.base64EncodeString(data),
|
text: $tw.plugins.dropbox.base64EncodeString(data),
|
||||||
type: mimeType
|
type: mimeType
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
tiddlers = $tw.wiki.deserializeTiddlers(mimeType,data,{title: path});
|
tiddlers = $tw.wiki.deserializeTiddlers(mimeType,data,{title: defaultTitle});
|
||||||
}
|
}
|
||||||
// Check to see if there's a metafile
|
// Check to see if there's a metafile
|
||||||
var metafilePath = path + ".meta",
|
var metafilePath = path + ".meta",
|
||||||
|
Loading…
Reference in New Issue
Block a user