aspnetcore-401617-rich-edit-client-api.md
The RichEdit topic is your entry point for information on RichEdit client-side API. Navigate to this document to review the full list of all available properties and methods. The two most commonly used properties are the following:
The following animation shows you how to effectively navigate the client-side documentation.
To access the editor on the client side, use the Name value specified on the server side.
@(Html.DevExpress().RichEdit("richEdit") //...
richEdit.adjust();
You can define the RichEdit control’s client-side event handlers in the following ways.
The RichEditBuilder object exposes methods that allow you to assign an event handler to a corresponding client-side event. These methods start with “On”: OnContentInserted(String), OnGotFocus(String), etc.
You can define an event handler in the control’s builder; or specify the event handler name in the builder, and define the event handler function on the page or in an external script file.
function onDocumentLoaded(s, e) { /* ... */ }
@(Html.DevExpress().RichEdit("richEdit")
.OnGotFocus("function(s,e){ /* ... */ }")
.OnDocumentLoaded("onDocumentLoaded")
//...
The Options.events property provides access to a list of available client events and allows you to define event handlers.
const options = DevExpress.RichEdit.createOptions();
options.events.gotFocus = function(s,e){ /* ... */ };
//...
var richElement = document.getElementById("rich-container");
const richEdit = DevExpress.RichEdit.create(richElement, options);
The RichEdit.events property provides access to a list of available client events.
Use the addHandler(handler), removeHandler(handler), and clearHandlers methods to dynamically add and remove event handlers.
richEdit.events.documentLoaded.addHandler(function(s, e) { /* ... */ });