mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 18:10:27 +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) {
|
"tw-SaveTiddler": function(event) {
|
||||||
var template = this.hasParameter("defaultViewTemplate") ? this.params.defaultEditTemplate : "SimpleTemplate",
|
var template = this.hasParameter("defaultViewTemplate") ? this.params.defaultEditTemplate : "SimpleTemplate",
|
||||||
storyTiddler = this.store.getTiddler(this.params.story),
|
storyTiddler = this.store.getTiddler(this.params.story),
|
||||||
story = {tiddlers: []};
|
story = {tiddlers: []},
|
||||||
|
storyTiddlerModified = false;
|
||||||
if(storyTiddler && storyTiddler.hasOwnProperty("text")) {
|
if(storyTiddler && storyTiddler.hasOwnProperty("text")) {
|
||||||
story = JSON.parse(storyTiddler.text);
|
story = JSON.parse(storyTiddler.text);
|
||||||
}
|
}
|
||||||
@ -74,10 +75,16 @@ exports.macro = {
|
|||||||
// Make the story record point to the newly saved tiddler
|
// Make the story record point to the newly saved tiddler
|
||||||
storyRecord.title = tiddler["draft.title"];
|
storyRecord.title = tiddler["draft.title"];
|
||||||
storyRecord.template = template;
|
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();
|
event.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user