On Tuesday, August 6, 2013 2:29:05 AM UTC-7, Clemens Feige wrote: > > On Thursday, August 1, 2013 6:13:25 AM UTC-7, Clemens Feige wrote: > >> Hi. > >> > >> How can I add custom buttons to the wiki toolbar which appears above > the > >> text area when editing tickets and wiki pages? > >> [...] > >> > > > RjOllos, 05.08.2013 19:55: > > The functionality is defined in wikitoolbar.js, (1) and should be fairly > > easy to extend. I'm minimally proficient in JavaScript and jQuery, so > I'll > > suggest one way it could probably be done, but there may be better ways. > In > > fact, someone might know of a way we could modify Trac so that it is > easier > > to add buttons. > > Hello RjOllos. > > Thank for pointing me to wikitoolbar.js and thanks for your help. It > seems this is indeed mostly a Java-Script and CSS issue. As far as I > understood you have cloned the original code from wikitoolbar.js.
Yeah I copied and then modified wikitoolbar.js. I don't see a way to reuse the functions in that file without copying them, but someone more fluent in JS may have an idea, or perhaps we can modify the source code distributed with Trac to allow for easier reuse of those functions. > The > trick is to call "addButton()" another time. Additionally you proposed > to wrap everything as a TRAC plugin, which is a good idea. Thanks. > > > 1. Put the JavaScript code at the of this message in > > $env/site/wikitoolbar_extensions.js > > 2. Put the Python code at the end of this message in > > $env/plugins/wikitoolbar_extensions.py > > I did as you said and it works on my TRAC 0.12.2. Thanks. > However I needed to put "wikitoolbar_extensions.js" in the $env/htdocs > directory instead $env/site. > That's correct. Sorry for that typo. > > You should see an additional entry on the next line, and it uses an > > "italics" icon. This is probably not what you want, so there are some > > additional steps to do: > > Yes, you are right. I see only the "italics" icon, because this is the > first one in the "edit_toolbar.png" background image. As you said, I > need to work a little with CSS to get the cosmetics nice looking. > > Let us know how it goes for you :) -- You received this message because you are subscribed to the Google Groups "Trac Users" 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/trac-users. For more options, visit https://groups.google.com/groups/opt_out.
