Client API

  • 2 minutes to read

The RichEdit Class 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:

  • document - provides access to document structural elements (such as sections, main sub-document, styles for characters, paragraphs, and tables).
  • selection - provides access to the selected content, allows you to position the cursor within a document, and to select document content elements.

The following animation shows you how to effectively navigate the client-side documentation.

  • The navigation bar on the left lists settings available at the current level (excluding the inherited members that are available in a class description).
  • Once you select an option, follow the link to its type in the Property Value section to learn about nested settings.

RichEdit - Client API

Access the editor on the client side

To access the editor on the client side, use the Name value specified on the server side.

@(Html.DevExpress().RichEdit("richEdit") ...
richEdit.adjust();

Client-Side events

You can define the RichEdit control’s client-side event handlers using the RichEditBuilder object. It 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 two ways:

  • Specify the corresponding client-side code in the control’s builder.

    @(Html.DevExpress().RichEdit("richEdit")
       .OnDocumentLoaded("function(s,e){…}")
       ...
    
  • Specify the event handler name in the builder, and define the event handler function on the page or in an external script file.

    @(Html.DevExpress().RichEdit("richEdit")
       .OnDocumentLoaded("onDocumentLoaded")
       ...
    
    function onDocumentLoaded(s, e) { ... }