Find and Replace in EJ 1 ASP.NET MVC RichTextEditor

27 Apr 2018 / 1 minute to read

RTE provides find and replace support, which is used to search for a keyword in RTE content and replace the matched keyword with a specified text. In order to use it, we have to enable the find and replace item in the editor toolbar (or) Press CTRL+F key.

  • html
  • @{ 
        List<String> edit = new List<string>() { "edit" };
        List<String> editTool = new List<string>() { "findAndReplace" };
    }
    
    @{Html.EJ().RTE("rteSample").Width("800px").ContentTemplate(@<div>
        The Rich Text Editor
        (RTE) control is an easy to render in client side. Customer easy to edit the contents
        and get the HTML content for the displayed content. A rich text editor control provides
        users with a toolbar that helps them to apply rich text formats to the text entered
        in the text area.
    </div>)
        .ToolsList(edit)
        .Tools(tool => tool.Edit(editTool))
    • Find and Replace action should happen in a following sequence:

      Find => Replace (or) Replace All.

    Action Descriptions
    Find Finds a keyword matches with the editor content.it consist of following filters. * Match Case. * Whole Word.
    Replace Replaces the particular selected match with the specified text.
    ReplaceAll Replaces the entire matches with the specified text.

    img1

    NOTE

    Before performing the Replace/ReplaceAll action, we must do the find action to validate the match’s availability.