mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 01:50:28 +00:00
Fixed problem with manually editting the story tiddler
Now you can manually edit StoryTiddler, which is quite fun
This commit is contained in:
parent
75279c2b13
commit
c57d1efefe
@ -58,7 +58,8 @@ exports.macro = {
|
||||
"tw-SaveTiddler": function(event) {
|
||||
var template = this.hasParameter("defaultViewTemplate") ? this.params.defaultEditTemplate : "SimpleTemplate",
|
||||
storyTiddler = this.store.getTiddler(this.params.story),
|
||||
story = {tiddlers: []};
|
||||
story = {tiddlers: []},
|
||||
storyTiddlerModified = false;
|
||||
if(storyTiddler && storyTiddler.hasOwnProperty("text")) {
|
||||
story = JSON.parse(storyTiddler.text);
|
||||
}
|
||||
@ -74,10 +75,16 @@ exports.macro = {
|
||||
// Make the story record point to the newly saved tiddler
|
||||
storyRecord.title = tiddler["draft.title"];
|
||||
storyRecord.template = template;
|
||||
// Check if we're modifying the story tiddler itself
|
||||
if(tiddler["draft.title"] === this.params.story) {
|
||||
storyTiddlerModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.store.addTiddler(new Tiddler(storyTiddler,{text: JSON.stringify(story)}));
|
||||
if(!storyTiddlerModified) {
|
||||
this.store.addTiddler(new Tiddler(storyTiddler,{text: JSON.stringify(story)}));
|
||||
}
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user