Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-06-23 17:26:43

chakal
Xinha Community Member
Registered: 2005-08-10
Posts: 18

Replacing toolbar on the fly ?

Hi,

Is it possible to add buttons to toolbar on the fly ?

I have a plugin with 10 buttons but I don't want to have always these buttons, so I created only one button and when I click on it, it add all other buttons to toolbar and call _createToolbar().

But I have 2 problems:
- the new toolbar works well but appears at the bottom of the editor, so I have 2 toolbars.
- removeToolbarElement() don't work as expected (but it's not so important)

I didn't see any _replaceToolbar(), so how I can replace the toolbar with my new one ?


 cfg.registerButton({
     id       : "morebuttons",
     tooltip  : this._lc("More buttons"),
     image    : _editor_url+"plugins/myplugin/img/morebuttons.gif",
     textMode : false,
     action   : function(editor) {

         cfg.registerButton({
             id       : "button1",
             tooltip  : self._lc("Button 1"),
             image    : _editor_url+"plugins/myplugin/img/button1.gif",
             textMode : false,
             action   : function(editor) {
                    alert("OK")
             }
         })
        cfg.removeToolbarElement("morebuttons");
        cfg.addToolbarElement("button1", "morebuttons", 1);
        editor._createToolbar();

     }
 })

Offline

Board footer

Powered by FluxBB