kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Use import report tiddler only if more than one tiddler is imported
If there’s only one, just display the tiddler itself.print-window-tiddler
rodzic
cf5fa875aa
commit
0961b0426b
|
@ -382,21 +382,30 @@ NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
|
||||||
var storyList = this.getStoryList(),
|
var storyList = this.getStoryList(),
|
||||||
history = [];
|
history = [];
|
||||||
// Create the import report tiddler
|
// Create the import report tiddler
|
||||||
var tiddlerFields = {
|
if(importedTiddlers.length === 0) {
|
||||||
title: this.wiki.generateNewTitle("$:/temp/Import Report"),
|
return false;
|
||||||
text: "# [[" + importedTiddlers.join("]]\n# [[") + "]]\n"
|
}
|
||||||
};
|
var title;
|
||||||
this.wiki.addTiddler(new $tw.Tiddler(
|
if(importedTiddlers.length > 1) {
|
||||||
self.wiki.getCreationFields(),
|
title = this.wiki.generateNewTitle("$:/temp/ImportReport");
|
||||||
tiddlerFields,
|
var tiddlerFields = {
|
||||||
self.wiki.getModificationFields()
|
title: title,
|
||||||
));
|
text: "# [[" + importedTiddlers.join("]]\n# [[") + "]]\n"
|
||||||
|
};
|
||||||
|
this.wiki.addTiddler(new $tw.Tiddler(
|
||||||
|
self.wiki.getCreationFields(),
|
||||||
|
tiddlerFields,
|
||||||
|
self.wiki.getModificationFields()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
title = importedTiddlers[0];
|
||||||
|
}
|
||||||
// Add it to the story
|
// Add it to the story
|
||||||
if(storyList.indexOf(tiddlerFields.title) === -1) {
|
if(storyList.indexOf(title) === -1) {
|
||||||
storyList.unshift(tiddlerFields.title);
|
storyList.unshift(title);
|
||||||
}
|
}
|
||||||
// And to history
|
// And to history
|
||||||
history.push(tiddlerFields.title);
|
history.push(title);
|
||||||
// Save the updated story and history
|
// Save the updated story and history
|
||||||
this.saveStoryList(storyList);
|
this.saveStoryList(storyList);
|
||||||
this.addToHistory(history);
|
this.addToHistory(history);
|
||||||
|
|
Ładowanie…
Reference in New Issue