Ok, I didn't get exactly what you already can and what is questionable for 
you, so let me add two guidelines.


First, if you want to automatically create a "create new" macro by direct 
manipulating of DOM, you can take a look at the newTiddler macro handler. 
The TW js core code can be found at GitHub [1] -- it is splitted in a 
number of "js files". Most of macros are defined in the Macros.js, but some 
are in separate files (due to their importance/code volume I guess) which 
is the case for the newTiddler macro [2]. config.macros.newTiddler.handler 
[3] is called to handle an ordinary <<newTiddler ...>> macro and, in turn, 
calls config.macros.newTiddler.createNewTiddlerButton [4] which is the 
thing you need. Though, there's a big deal to understand which parameters 
you have to set and how. "place" seems to be a parent node to which the 
button is attached, but there's "params" which you have to understand.


Ok, second option is to use "reverse engineering" and write to the document 
directly. If I create a newTiddler via this syntax:

<<newTiddler tag:"sampleTag" text:"sampleText" label:"sampleLabel">>

Opera DragonFly (analogue for FireFox: FireBug extension) shows me this DOM:

<a href="javascript:;" title="Create a new tiddler" class="button" 
accesskey="N" newtitle="New Tiddler" isjournal="false" params="sampleTag" 
newfocus="title" newtemplate="2" newtext="sampleText">sampleLabel</a>

and also a "click" event handler which is actually 
config.macros.newTiddler.onClickNewTiddler [5]. You can write this tags to 
the document directly and than add an event handler.


This isn't of'course a complete "how to", but this is something to start 
from. Hope this will help,
Yakov.

[1] https://github.com/TiddlyWiki/tiddlywiki/tree/master/js
[2] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/NewTiddler.js
[3] 
https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/NewTiddler.js#L62
[4] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/NewTiddler.js#L5
[5] 
https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/NewTiddler.js#L35

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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/tiddlywikidev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to