[tw] Re: SinglePageModePlugin configuration question

2009-10-20 Thread Shane

http://www.TiddlyTools.com/#CloseOtherTiddlers

This is excellent, but it has one behavior that confuses me.  Consider
one tiddler X that has CloseOtherTiddlers in it, and others that do
not.  If I pick X from a menu while others are displayed, the others
are closed as advertised.  However, if X is already on screen when
others are displayed, and I re-pick X from the menu the others are not
closed.

Is that an intended behavior?  If it is, is there a way to force
others to close even if the tiddler containing CloseOtherTiddlers is
already displayed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~--~~~~--~~--~--~---



[tw] Re: SinglePageModePlugin configuration question

2009-10-20 Thread Eric Shulman

 not.  If I pick X from a menu while others are displayed, the others
 are closed as advertised.  However, if X is already on screen when
 others are displayed, and I re-pick X from the menu the others are not
 closed.

This is a side-effect of the core's handling for displayTiddler()

If a tiddler is not already displayed, then clicking a link to it
parses and renders it as usual.  However, if a tiddler is already
displayed, then clicking the link merely scrolls that previously
rendered tiddler into view, *without* re-rendering it's content.

At first glance, it might seem that the fix would be to have the
CloseOtherTiddlers script simply trigger a re-rendering of the tiddler
as well.  Unfortunately, this would be cause an infinite loop, because
every time the tiddler is rendered it triggers the 're-render'
function, which causes it to be rendered again, which triggers the
function... etc.

Another way to implement the 'close others' behavior would be to
create a special *link* for the desired tiddler, so that **clicking
the link** triggers the 'close others' processing, rather than binding
it to the **display** of the tiddler itself.

Using HTML embedded in tiddler content, you can write:

htmlnowiki
a href=javascript:;
   class=TiddlyLinkExisting
   tid=NameOfTiddler
   onclick=
  story.closeAllTiddlers(this.tid);
  story.displayTiddler(null,this.tid);
  story.refreshTiddler(this.tid,null,true);
  return false;
link text goes here/a/html

The three lines of code in the onclick handler do the following:
1) close tiddlers except the 'target' title
2) display the target tiddler (in case not already shown)
3) force a refresh of the content in the target tiddler (re-renders if
already shown)

This approach doesn't cause an infinite loop because the call to
story.refreshTiddler() is not being triggered by the refresh itself,
but rather by the click on the link that occurs just once.

Of course, this doesn't help when a link to the target title simply
occurs in context within your tiddler content.  Such a link would
simply open the tiddler as usual, without the added closeOtherTiddlers
() functionality.

In order to get the link behavior you want, you would have to embed
the same HTML syntax for each link, which would be a real nuisance.
To make it much easier to embed the above HTML link into several
places without repeating the HTML code in each instance, you can put
the html.../html block into a 'hidden section' at the end of the
target tiddler, like this:
   /%
   !closeOthers
   html.../html
   !end
   %/

Then, you can embed the section content (i.e., the HTML link syntax)
into any other tiddler like this:
   tiddler NameOfTiddler##closeOthers

Although not a succinct as simply writing NameOfTiddler, if there
are only a few of these special target tiddlers, this might be
sufficient for your purposes and not too much of a hassle.

enjoy,
-e





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~--~~~~--~~--~--~---



[tw] Re: SinglePageModePlugin configuration question

2009-10-17 Thread Eric Shulman

 Is there a way to configure SinglePageModePlugin (http://
 tiddlytools.com/#SinglePageModePlugin) so only certain tiddlers invoke
 it?  I have a few tables of contents that I'd like to close all
 other tiddlers before being displayed.

SinglePageModePlugin always applies to all tiddlers: when a tiddler is
opened, all other tiddlers are automatically closed.

To get the same behavior only for specific tiddlers, instead of using
SinglePageModePlugin, you can use
   http://www.TiddlyTools.com/#CloseOtherTiddlers

After importing this tiddler (note: it's *not* a plugin... do not tag
it with 'systemConfig')... simply embed the following in the desired
tiddlers:
   tiddler CloseOtherTiddlers
This will trigger the 'close others' action each time any of those
tiddlers are opened, but not when other tiddlers are opened.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~--~~~~--~~--~--~---



[tw] Re: SinglePageModePlugin configuration question

2009-10-17 Thread Shane

Wow, fantastic.  Thanks.

One more question about SinglePageModePlugin, how does it interact
with search results?

-Shane

On Oct 17, 12:03 pm, Eric Shulman elsdes...@gmail.com wrote:
  Is there a way to configure SinglePageModePlugin (http://
  tiddlytools.com/#SinglePageModePlugin) so only certain tiddlers invoke
  it?  I have a few tables of contents that I'd like to close all
  other tiddlers before being displayed.

 SinglePageModePlugin always applies to all tiddlers: when a tiddler is
 opened, all other tiddlers are automatically closed.

 To get the same behavior only for specific tiddlers, instead of using
 SinglePageModePlugin, you can use
    http://www.TiddlyTools.com/#CloseOtherTiddlers

 After importing this tiddler (note: it's *not* a plugin... do not tag
 it with 'systemConfig')... simply embed the following in the desired
 tiddlers:
    tiddler CloseOtherTiddlers
 This will trigger the 'close others' action each time any of those
 tiddlers are opened, but not when other tiddlers are opened.

 enjoy,
 -e
 Eric Shulman
 TiddlyTools / ELS Design Studios
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~--~~~~--~~--~--~---



[tw] Re: SinglePageModePlugin configuration question

2009-10-17 Thread Eric Shulman

 One more question about SinglePageModePlugin, how does it interact
 with search results?

The default core behavior for search results is to display all the
matching tiddlers, by invoking the core function: story.displayTiddlers
().  SinglePageModePlugin **momentarily bypasses itself when
displayTiddlers() is called**, so that all the matching tiddlers can
be displayed as expected.  Note, however, that single-page mode is
still enabled, so subsequently opening any other tiddler *does* close
all the others.

enjoy,
-e

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TiddlyWiki group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~--~~~~--~~--~--~---