Hi Andy

(This kind of thing is probably best discussed over in the dev group
https://groups.google.com/forum/#!forum/TiddlyWikiDev)

The mechanism by which clicking on a link causes a new tiddler to open is
very different in TW5, and hopefully much more flexible. It allows for
multiple story rivers and a high degree of control over what happens when a
link is clicked.

I'll explain it briefly with reference to the code.

We start with the link widget, which contains the click event handler for
hyperlinks:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/link.js#L93

The click handler sends a custom DOM event called "tw-navigate" containing
information about the target of the link and the screen location of the
link text.

The custom event is sent to the <a> element of the link, and it then
travels back up the DOM tree looking for a handler. Ordinarily, the handler
is provided by the <$navigator> widget:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/navigator.js#L79

It's job is the capture the "tw-navigate" events and modify a story list in
response. The story list is a system tiddler containing the titles of each
of the tiddlers displayed in the main story river (by default it's called
`$:/StoryList`). So, the navigator widget adds the title of the tiddler
that is to be displayed to the story list at the appropriate point.

That navigator widget is the outermost widget in the page template:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/ui/PageTemplate.tid#L4

That modification to the story list then triggers an asynchronous refresh
of the display, in which the <$list> widget that displays the main story
column notices that the story list has changed and then intelligently adds
and removes DOM elements so that the display matches the story list.

In fact, there are two <$list> widgets displaying the main story list: one
is the main story river, and the other is the "open" tab in the sidebar:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/ui/PageTemplate.tid#L31
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/ui/SideBar.tid#L31

So, the upshot of all of this is that there are two basic ways to display a
new tiddler:

* Modify the story list directly to add the tiddler title
* Send a tw-navigate event into the DOM

I hope that brief summary makes sense, let me know if I can clarify
anything,

Best wishes

Jeremy




On Thu, Aug 1, 2013 at 3:27 PM, AndyB <[email protected]> wrote:

> A newbee question: is there in Tiddlywiki5 an equivalent for
> displayTiddler function as found in Tiddlywiki classic?
> For example, executing window.story.displayTiddler(null,'myTitle') in web
> console,  the tiddler "myTitle" is displayed in Tiddlywiki classic, but I
>  don't know nothing similar in Tiddlywiki5.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to