I want a button at the top of the toolbar for each tiddler that pops
out a moveable panel (Eric's plugin) and within this moveable panel I
want to call my macro (thundertag) or any other macro I so choose.
However, this macro needs to apply to the current tiddler and not the
tiddler that holds the moveable panel. Even if toggleTag takes in a
target reference, how am I to tell it ahead of time which tiddler is
going to be the parent (that is, the tiddler with the embedded moveable
panel)? Thanks.
> >
>
> ------=_Part_6067_14434505.1149256553293
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 1344
>
> <br><br><div><span class="gmail_quote">On 6/2/06, <b class="gmail_sendername">DigitalOrganics</b> <<a href="mailto:digital...@gmail.com">digital...@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> <br>I've got more questions! :-) When you embed tiddlers into each other,<br>how do you get macros within the embedded tiddlers to "know about" the<br>parent tiddler? Is this even possible? More specifically, I'm trying to
> <br>put a moveable panel into each tiddler by embedding a tiddler<br>containing the moveable panel into the viewtemplate. I call macros<br>within the moveable panel but they need to be aware of the parent<br>tiddler and not the tiddler than holds the panel, if I'm making any
> <br>sense here.</blockquote><div><br>As far as I remember, the toggleTag macro lets you specify the target tiddler, that should take care of your problem.<br>But, what is that you are trying to accomplish? I cant help but think that whatever it is, there has to be an easier way!
> <br><br>Cheers,<br>Saq<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Let me know if I'm speaking gobblygook, thanks.<br><br>
> <br>
> ------=_Part_6067_14434505.1149256553293--
> PS: I think you will greatly increase your chances of a reply if you make
> your subject lines a little more descriptive of the post itself. ;)
>
Thanks Saq.
Macro handlers are automatically passed a 'place' parameter that
identifies the 'containing DOM element' into which the macro can
produce output (by adding its own DOM elements)
Within the macro handler code, you can use:
story.findContainingTiddler(place)
to loop through successive parent DOM elements of 'place' until it
finds the containing tiddler element. Note that this function returns
a *DOM element*, not a tiddler object. To get the tiddler object, you
can use something like this:
var here=story.findContainingTiddler(place);
if (here) var title=here.getAttribute("tiddler");
if (title) var tiddler=store.getTiddler(title);
This same code can also be used with inline javascript (enabled by the
InlineJavascriptPlugin). The script plugin automatically defines
'place' for you...
for example:
<script>
var here=story.findContainingTiddler(place);
if (here) var title=here.getAttribute("tiddler");
if (title) var tiddler=store.getTiddler(title);
return title+" is "+tiddler.text.length+" bytes long";
</script>
HTH,
-e
Eric Shulman
TiddlyTools / ELS Design Studios