diff --git a/bld.sh b/bld.sh index 55afc03a9..3166a84e2 100755 --- a/bld.sh +++ b/bld.sh @@ -8,7 +8,6 @@ mkdir -p tmp/tw5 # cook TiddlyWiki5 - pushd tw5.com > /dev/null node ../core/boot.js \ diff --git a/core/modules/macros/link.js b/core/modules/macros/link.js index 90460814e..0e79feb50 100644 --- a/core/modules/macros/link.js +++ b/core/modules/macros/link.js @@ -36,6 +36,7 @@ exports.handleEvent = function (event) { var navEvent = document.createEvent("Event"); navEvent.initEvent("tw-navigate",true,true); navEvent.navigateTo = this.params.to; + navEvent.navigateFrom = this; event.target.dispatchEvent(navEvent); event.preventDefault(); return false; diff --git a/core/modules/macros/story/story.js b/core/modules/macros/story/story.js index b1a8d8cc0..d2fe369e5 100644 --- a/core/modules/macros/story/story.js +++ b/core/modules/macros/story/story.js @@ -1,8 +1,18 @@ /*\ -title: $:/core/modules/macros/story.js +title: $:/core/modules/macros/story/story.js type: application/javascript module-type: macro +Displays a sequence of tiddlers defined in a JSON structure: + + { + tiddlers: [ + {title: , template: } + ] + } + +The storyview is a plugin that extends the story macro to implement different navigation experiences. + \*/ (function(){ @@ -26,7 +36,8 @@ exports.info = { params: { story: {byName: "default", type: "tiddler"}, defaultViewTemplate: {byName: true, type: "tiddler"}, - defaultEditTemplate: {byName: true, type: "tiddler"} + defaultEditTemplate: {byName: true, type: "tiddler"}, + storyview: {byName: true, type: "text"} }, events: ["tw-navigate","tw-EditTiddler","tw-SaveTiddler"] }; @@ -116,17 +127,25 @@ exports.handleEvent = function(event) { }; exports.executeMacro = function() { - var story = JSON.parse(this.wiki.getTiddlerText(this.params.story)), - children = []; - for(var t=0; t t) { // First delete the DOM nodes for(n=t; n story.tiddlers.length) { - for(t=story.tiddlers.length; t story.tiddlers.length) { + for(t=story.tiddlers.length; t