[wikka-community] adding a button to the wikka editor

Mike C mailmichael
Fri Sep 18 04:49:09 GMT 2009


Hi, 

I just joined this mailing list to ask how to create my own button 
in WikkaEdit.  Fortunately for you :), I was able to figure it out 
myself.  Thus, I thought I would share. (BTW, couldn't figure out 
how to search the mailman archives... if anyone knows, let me know! 
TIA) 

To add a custom button, follow the procedures below.  The example 
below shows how to insert a date stamp. 

Edit 3rdparty/plugins/wikkaedit/wikkaedit_data.js to add in the 
button.  Inside this function: 

   WikkaEdit.prototype.initButtons = function() { 

add the following line where appropriate: 

   this.we_buttons.we_date = {type:"button", title:"Date"}; 

Then in 3rdparty/plugins/wikkaedit/wikkaedit.js, tell it what to 
do when the button gets clicked: 

   case "date" : this.addToSelection(Date()); break; 

Lastly, create/add a gif for date in the 
3rdparty/plugins/wikkaedit/images folder named after the 
button/command: 

   images/date.gif 

I just copied over one of the other gifs.  Perhaps I'll make a 
custom one.  Another thing I may do eventually is read up on 
Javascript to reduce the date to something better suited for a 
Wikka page.

Hope this is useful to someone. 

Best Regards, 
Mike 




More information about the community mailing list