QuickTags Part III

Someone asked me how you could add custom tags to the QuickTags toolbar. Its quite simple really, the js_quicktags has a commented part explaining it:

function edButton(id, display, tagStart, tagEnd, open) {
    this.id = id;               // used to name the toolbar button
    this.display = display;     // label on button
    this.tagStart = tagStart;   // open tag
    this.tagEnd = tagEnd;       // close tag
    this.open = open;           // set to -1 if tag does not need to be closed
}

So you could just add something like this:

edButtons[edButtons.length] = new edButton('ed_code'
                                         ,'code'
                                         ,'<code>'
                                         ,'</code>'
                                         );

To create a button to produce <code> ... </code> tags ! This will need to be added to the top of js_quicktags.js where you will find similar code that define the other buttons !