Announcement

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

#1 2011-11-22 16:40:52

patschannach
New member
Registered: 2011-09-14
Posts: 9

Howto intercept toolbar icon click?

I want to intercept the click of the 'Clear Inline Font Specifications' button so that I can avoid the confirm boxes shown by Xinha.prototype._clearFonts() method.
From what I can tell, overriding Xinha.prototype._clearFonts() would do me no good because I never new up a Xinha (it's done internally by Xinha).
Therefore I'm thinking I need to intercept the click of the 'Clear Inline Font Specifications' button somehow and basically do what _clearFonts() does, MINUS the
confirm dialogs.

Any thoughts on how to do this?

Thank you.

Offline

#2 2011-11-27 18:57:23

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Howto intercept toolbar icon click?

Overriding the Xinha.prototype._clearFonts should work fine.

Xinha.prototype._clearFonts = function() { ... }

Of course, you must do this AFTER you load Xinha's file or it will be redefined to the default.


James Sleeman

Offline

#3 2011-11-28 16:50:31

patschannach
New member
Registered: 2011-09-14
Posts: 9

Re: Howto intercept toolbar icon click?

Ok.  I see what you are saying here, but I wouldn't call that overriding the function.
I think of that as basically wiping it out with my own, which I agree will work.

I chose a different way, basically registered a button and a handler for it:

xinhaConfig.hideSomeButtons(' clearfonts ');
var xinhaEditors = [ this.containerRichTextId ];
...
// register the toolbar buttons provided by this plugin
this.myEditor.config.registerButton(
    {
        id       : "mw_clearfonts",
        tooltip  : Xinha._lc("Clear Fonts", "Clear Fonts"),
        image    : this.myEditor.imgURL("images/ed_clearfonts.gif"),
        textMode : true,
        action   : function(editor) {
             self._removeFonts();
           }
});

Offline

Board footer

Powered by FluxBB