aspnetcore-js-devexpress-dot-richedit-3bce1667.md
An event that occurs after a custom command has been executed on the client side.
export class CustomCommandExecutedEvent extends RichEditEvent<CustomCommandExecutedEventArgs>
You can define the CustomCommandExecuted event handler either at the server side, at the client side, or at runtime.
Use the OnCustomCommandExecuted(String) method to specify the event handler.
@(Html.DevExpress().RichEdit("richEdit")
.OnCustomCommandExecuted("function(s,e) {
switch (e.commandName) {
case 'sendEmail':
var text = s.document.getText();
var mailto_link = 'mailto:[email protected]?subject=Test&body=' + encodeURIComponent(text);
window = window.open(mailto_link, 'emailWindow');
if(window && window.open && !window.closed)
window.close();
break;
}
}")
// ...
Use the customCommandExecuted property to specify the event handler.
const options = DevExpress.RichEdit.createOptions();
options.events.customCommandExecuted = function(s,e) {
switch (e.commandName) {
case 'sendEmail':
var text = s.document.getText();
var mailto_link = 'mailto:[email protected]?subject=Test&body=' + encodeURIComponent(text);
window = window.open(mailto_link, 'emailWindow');
if(window && window.open && !window.closed)
window.close();
break;
}
};
The customCommandExecuted property provides access to the addHandler(handler), removeHandler(handler), and clearHandlers methods that allow you to dynamically add and remove event handlers.
richEdit.events.customCommandExecuted.addHandler(function(s, e) {
switch (e.commandName) {
case 'sendEmail':
var text = s.document.getText();
var mailto_link = 'mailto:[email protected]?subject=Test&body=' + encodeURIComponent(text);
window = window.open(mailto_link, 'emailWindow');
if(window && window.open && !window.closed)
window.close();
break;
}
});
The event handler receives an argument of the CustomCommandExecutedEventArgs type. The argument’s properties provide information specific to this event.
Event<TSource, TEventArgs> RichEditEvent<TEventArgs> CustomCommandExecutedEvent
See Also