Toolbar Configuration

The editor’s toolbar contains a collection of tools such as bold, italic and text alignment buttons that are used to format the content.

However, in most integrations, it’s desirable to change the toolbar configuration to suit needs. Fortunately, that’s quite easy to do too.

Property

Description

toolsList



The toolsList option allows you to choose which tools appear on the toolbar, as well as the order and grouping of those items

tools



The toolsList property is used to get the root group order and tools property is used to get the inner order of the corresponding groups displayed.

NOTE

By default, when you tab from the textbox to the RTE, the first tools in the Toolbar of RTE will get focus not in the text area.

But we can able to focus the RTE text area by setting the tab index attribute as -1 to avoid the focus on RTE toolbar when we tab from textbox to RTE - <p>Demo</p>

Toolbar Items

The following table lists the available buttons and dropdowns on the toolbar:

Name
Summary
Initialization
isDefault?
Font
Applies font type, size, and color to the content
<ej:RTE ID="RTE1" ToolsList="font" runat="server">
<Tools Font="fontName,fontSize,fontColor,backgroundColor"></Tools>
</ej:RTE>

No
Font style
Applies bold, italic, underline, and strikethrough formatting to the content
<ej:RTE ID="RTE1" ToolsList="style" runat="server">
<Tools Styles="bold,italic,underline,strikethrough"></Tools>
</ej:RTE>

yes
Alignment
Align the content with left, center, and right margin.
<ej:RTE ID="RTE1" ToolsList="alignment" runat="server">
<Tools Alignment="justifyLeft,justifyCenter,justifyRight,justifyFull"></Tools>
</ej:RTE>

yes
List
Create a new list item (bulleted/numbered).
<ej:RTE ID="AllToolsSample" ToolsList=" lists " runat="server">
<Tools Lists="unorderedList,orderedList"></Tools>
</ej:RTE>

yes
Indents
Allows to increase/decrease the indent level of the content.
<ej:RTE ID="AllToolsSample" ToolsList=" indenting " runat="server">
<Tools Indenting="outdent,indent"></Tools>
</ej:RTE>

yes
Undo/Redo Action
Allows to undo/redo the actions
<ej:RTE ID="AllToolsSample" ToolsList="doAction" runat="server">
<Tools DoAction="undo,redo"></Tools>
</ej:RTE>

yes
Hyperlink
Creates a hyperlink to a text or image to a specific location in the content.
<ej:RTE ID="AllToolsSample" ToolsList="links" runat="server">
<Tools links = "createLink, removeLink”></Tools>
</ej:RTE>

yes
Images
Inserts an image from an online source or local computer.
<ej:RTE ID="AllToolsSample" ToolsList="images" runat="server">
<Tools Images="image"></Tools>
</ej:RTE>

yes
Media
Allows to embed a video into the document.
<ej:RTE ID="AllToolsSample" ToolsList="media" runat="server">
<Tools Media="video"></Tools>
</ej:RTE>


yes
Table
Allows to add or modify Tables
<ej:RTE ID="AllToolsSample" ToolsList="tables" runat="server">
<Tools Tables="createTable,addRowAbove,addRowBelow,addColumnLeft,addColumnRight,deleteRow,deleteColumn,deleteTable"></Tools>
</ej:RTE>


yes
Casing
Change the case of selected text in the content
<ej:RTE ID="AllToolsSample" ToolsList="casing" runat="server">
<Tools Casing="upperCase,lowerCase"></Tools>
</ej:RTE>

no
Scripts
Makes the selected text as superscript (higher) or subscript (lower).
<ej:RTE ID="AllToolsSample" ToolsList="effects" runat="server">
<Tools Effects="superscript,subscript"></Tools>
</ej:RTE>


no
Format
Clears the formatting options like bold, italic, underline and more.
<ej:RTE ID="AllToolsSample" ToolsList="formatStyle" runat="server">
<Tools FormatStyle="format"></Tools>
</ej:RTE>

yes
Clipboard Actions
Controls the clipboard actions by applying specific action on the selected content.
<ej:RTE ID="AllToolsSample" ToolsList="clipboard" runat="server">
<Tools Clipboard="cut,copy,paste"></Tools>
</ej:RTE>

no

Rearrange Group

The toolbar contains groups, which are similar or related functionalities of toolbar items for efficient access. By default, the groups are arranged using the following order:

  • html
  • ToolsList = "formatStyle,font,style,effects,alignment,lists,indenting,clipboard,doAction, 
    	clear,links,images,media,tables,casing,customTools,view"

    The group can be rearranged on customization using the ToolsList property.

  • html
  • <ej:RTE ID="AllToolsSample" Width="100%" Height="440"  runat="server"  ToolsList="links,lists,doAction,style,images">
        <RTEContent>
            Description:
            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. 
        </RTEContent>
        <Tools Styles="bold,italic,underline,strikethrough"
            DoAction="undo,redo"
            Lists="unorderedList,orderedList"
            Links="createLink,removeLink"
            Images="image">               
        </Tools>
    </ej:RTE>

    NOTE

    If you are not specifying any group in ToolsList property, the editor will create the toolbar with default group.

    Undo and Redo

    Undo and Redo buttons allow you to editing the text by disregard/cancel the recently made changes and restore it to previous state. It is a useful tool to restore the performed action which got changed by mistake. Up to 50 actions can be undo/redo in the editor by default.

    To undo and redo operations, do one of the following:

    • Press the undo/redo button on the toolbar
    • Press the Ctrl + Z/Ctrl + Y combination on the keyboard
  • html
  • <ej:RTE ID="RTE1"  ToolsList="doAction" runat="server">
        <RTEContent>
            Description:
            <p> 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. </p>
        </RTEContent>
        <Tools DoAction="undo,redo">               
        </Tools>
    </ej:RTE>

    Clipboard Operations

    The editor provides support for the clipboard operations (cut, copy, and paste) in all text and images using the toolbar buttons and the keyboard shortcuts. Toolbar includes buttons through which the clipboard operations, such as Cut, Copy, and Paste can be accessed.

    You can use the keyboard shortcuts to perform the clipboard operations.

    • Cut - CTRL+X
    • Copy - CTRL+C
    • Paste - CTRL+V

    NOTE

    Some browsers block the clipboard access from JavaScript. If you want to use the Cut, Copy, and Paste buttons on the toolbar, you need to allow JavaScript to use the clipboard. If you don’t want to do this configuration, use CTRL+C, CTRL+X, and CTRL+V keyboard commands.

  • html
  • <ej:RTE ID="RTE1" ToolsList="clipboard" runat="server">
        <RTEContent>
            Description:
            <p> 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. </p>
        </RTEContent>
        <Tools Clipboard="cut,copy,paste">               
        </Tools>
    </ej:RTE>

    Specify Custom Tools

    Beside the available built-in tools, the RichTextEditor’s toolbar functionality can be extended through custom tools, defined in the tools through the customTools options, which renders the custom toolbar items along with the built-in toolbar items.

    The example below demonstrates how to add a custom tool button

  • html
  • <ej:RTE ID="AllToolsSample" Width="100%" Height="440"  runat="server"  ToolsList="customTools">
        <RTEContent>
            Description:
            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. 
        </RTEContent>
            <Tools>
                <CustomTools>
                    <ej:CustomTools Action="CustomTool" Css="insert-special-character" Name="specialCharacter" Text="Insert - O" Tooltip="Special Characters" />
                </CustomTools>      
        </Tools>
    </ej:RTE>

    Upon clicking the “Insert” button, the special character will be added to the RTE’s content.

  • html
  • <script>
            var rteObj =  $("#<%=AllToolsSample.ClientID%>").data("ejRTE");
        $(".insert-special-character").ejButton();
        $("#specialCharacter").ejDialog({ enableResize: false, enableModal: true, showOnInit: false, width: "auto", position: { X: 218, Y: 38 } });
        $(".special-table tbody tr td" ).addClass("special-table-data").on( "click", customTdClick);
        function customTdClick(args) {
            rteObj.executeCommand("inserthtml", args.currentTarget.innerText);
            $("#specialCharacter").ejDialog("close");
        }  
        function CustomTool(args){
            $("#specialCharacter").ejDialog("open");   
        }
    </script>

    Define the CSS that will be applied to the custom tool.

  • html
  • .e-special-table tr td
    {
        border:1px solid #c8c8c8;
    }
    .e-special-table-data:hover
    {
        background-color:#86bcea;
        cursor:pointer;
    }

    NOTE

    The CSS class that defined for custom tool is directly applies to the newly added toolbar item.

    IMPORTANT

    The custom buttons get a insert-special-character CSS class to allow styling, where name is the name specified in the custom tool configuration.