addButtonStateHandler

Availability: >= 3.0

Type: Object Method

Description: Registers a new button state handler.

Syntax:

editor.addButtonStateHandlerstring handlerid, function function );

A button state handler is a JavaScript function that controls when a button should be displayed as ready, disabled or latched.

The ID name of a button state handler is used as the last parameter of the registerButton PHP API method. 

Parameters: 

handlerid
The ID name of the new button state handler. This is used when registering a new button that should be controlled by this handler.

function
The JavaScript function to control the button state.

Example: 

The following example creates a button state handler that shows buttons as latched if they are within a cite tag. The handler has been given an ID of 'citehandler'. Any buttons that have this handler ID will be controlled by this handler function.

// register the handler for the new button:
WPro.editors['myEditor'].addButtonStateHandler ('citehandler', function (EDITOR,srcElement,cid,inTable,inA,range){
    var 
range.getContainerByTagName("CITE");
    if (
c) {
        return 
"wproLatched";
    } else {
        return 
"wproReady";
    }
});