I have always wanted the in-tiddler table of contents to jump to the 
appropriate heading when clicked and tough assured repeatedly that such 
behavior would be extremely difficult if not impossible that message never 
quite made it through my thick skull. Now I am extremely close to getting 
the behavior I want. There are still some rough edges and I secretly hope 
that someone, like Danielo perhaps, can help me push it over the top.

I've made a couple of key modifications since the version listed earlier in 
this thread. 

https://groups.google.com/forum/#!searchin/Tiddlywiki/toc$20single%7Csort:date/tiddlywiki/6zBxrj4nV34/NucvoBSuscYJ

I changed the ToC items to invisible buttons and added the message so that 
it would write the name of the selected heading to a data tiddler.

\define regex-feature-header() (^!+.*)(?gmi)
<div class="box">
<h3 style="text-align: center;"><u>Table of Contents</u></h3>
<div class="TOC">
<ul style="list-style-type:square">
<$list filter="[all[current]match:text<regex-feature-header>]">
<li>
<$button class="tc-btn-invisible" >

{{!!title}}
<$action-setfield $tiddler="$:/sk/new-find" text={{!!title}} />
</$button>
</li>
</$list>
</ul>
</div>
<$click/>
</div>

You'll note that I added `<$click>` as well. This goes to my modification 
of Danielo's ~DoubleClick to edit. In my version instead of invoking the 
editor, I use 

var lastfound=this.wiki.getTextReference('$:/sk/new-find');
     
    lastfound = lastfound.replace(/!/gm, '');

var  strFound=self.find(lastfound);
  if (!strFound) {
   strFound=self.find(lastfound,0,1);
   while (self.find(lastfound,0,1)) continue;
}

Now, a single click on the Table of Contents item writes the heading to the 
data tiddler and a following double click jumps to that heading within the 
tiddler. So to jump to the first occurrence of a heading item, you have to 
click three times. I would rather just double click but there is a 
programming step I'm missing. And if you have two different headings with 
the same text, it will find the first one. To find the second one, you 
would have to go back to the ToC and double click the entry again. 

This is functional and extremely close to what I want though sub-optimal.  
I would rather have a simple double click accomplish everything and I would 
like a simple repeat search keyboard shortcut so I could avoid having to 
scroll to the top.  I would appreciate it if someone could suggest how I 
could further modify this.

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7cd9601e-8b4a-4106-ad28-cd49fde8756a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to