> //{{{
> config.tasks.macros = {
> text: "macros",
> tooltip: "Access the raw tiddlers",
> content: "<<newTiddler>><<saveChanges>>"
> };
> config.backstageTasks.push("macros");
> //}}}
The above code will create a backstage menu called "macros" plus a
dropdown slider containing the <<newTiddler>> and <<saveChanges>>
macros. Clicking the menu item displays the dropdown slider with the
rendered macro commands, which you then need to click on in order to
invoke their functionality.
I'm fairly certain that this is *not* what wolfgang was asking for.
Rather, I think that what he wants is to be able to add a command
*directly* to the backstage menu, that immediately *invokes* the new
tiddler command, without the dropdown slider and extra click.
To do this, instead of defining a "content" property with text to
render for the backstage dropdown, you need to define an "action"
property that defines a function to invoke when the backstage menu
item is clicked.
Unfortunately, the <<newTiddler>> macro doesn't have a convenient
function entry point to invoke it's handling, so we need write a
little action code that *invisibly* renders and clicks on the macro
command to trigger the desired processing.
Here's how:
-------------------
config.tasks.newTiddler = {
text: 'new tiddler',
tooltip: config.macros.newTiddler.prompt,
action: function(){
var e=createTiddlyElement(document.body,'span');
e.style.display='none';
wikify("<<newTiddler>>",e);
e.getElementsByTagName('a')[0].onclick(ev);
document.body.removeChild(e);
}
}
config.backstageTasks.push("newTiddler");
-------------------
The "action" function first creates a container (and hides it using
CSS). Next, it renders the <<newTiddler>> macro into the container.
Then, it looks in the container to find the resulting "a" (link)
element produced by the rendered macro, and invokes it's "onclick"
handler to trigger the macro processing. Lastly, it cleans up by
removing the container used to render the macro.
If you put the above code into a systemConfig tiddler, you should be
all set.
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
----
TiddlyTools needs YOUR financial support...
Help ME to continue to help YOU...
make a generous donation today:
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.