Skip to main content
A newer version of this page is available. .
JS

RichEditBuilder.OnCustomCommandExecuted(String) Method

Assigns an event handler to a client event that occurs after a custom command has been executed on the client side.

Namespace: DevExpress.AspNetCore.RichEdit

Assembly: DevExpress.AspNetCore.RichEdit.v19.2.dll

Declaration

public RichEditBuilder OnCustomCommandExecuted(
    string callback
)

Parameters

Name Type Description
callback String

The name of a JavaScript function or the entire JavaScript function code used to handle an event.

Returns

Type Description
RichEditBuilder

An object that can be used to further configure the Rich Text Editor.

Remarks

The event handler receives an argument of the CustomCommandExecutedEventArgs type. The argument’s properties provide information specific to this event.

function onCustomCommandExecuted(s, e) {
    switch (e.commandName) {
        case 'insertEmailSignature':
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, '_________');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'Best regards,');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'John Smith');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, 'john@example.com');
            s.document.insertParagraph(s.document.length);
            s.document.insertText(s.document.length, '+1 (818) 844-0000');
            break;
        case 'sendEmail':
            var text = s.document.getText();
            var mailto_link = 'mailto:bob@example.com?subject=Test&body=' + encodeURIComponent(text);
            window = window.open(mailto_link, 'emailWindow');
            if(window && window.open && !window.closed)
                window.close();
            break;
    }
}

For a full example, see Ribbon Customization demo.

See Also