Toolbar in Angular Rich text editor component

16 Dec 202324 minutes to read

The Rich Text Editor 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, you can customize the toolbar configurations easily to suit your needs.

To get start quickly about customizing the toolbar in Angular Rich Text Editor component, refer to the video below.

To use Toolbar feature, inject ToolbarService in the provider section of AppModule.

The Rich Text Editor allows you to configure different types of toolbar using type field in toolbarSettings property. The types of toolbar are:

  1. Expand
  2. MultiRow

Expand Toolbar

The default mode of toolbar is Expand, it will hide the overflowing items in the next row. Click the expand arrow to view overflowing toolbar items.

import { Component } from '@angular/core';
import { ToolbarService, HtmlEditorService } from '@syncfusion/ej2-angular-richtexteditor';
@Component({
    selector: 'app-root',
    template: `<ejs-richtexteditor id='defaultRTE' [toolbarSettings]='tools'>
    <ng-template #valueTemplate>
      <p>The Rich Text Editor triggers events based on its actions. </p>
      <p> The events can be used as an extension point to perform custom operations.</p>
      <ul>
          <li>created - Triggers when the component is rendered.</li>
          <li>change - Triggers only when RTE is blurred and changes are done to the content.</li>
          <li>focus - Triggers when RTE is focused in.</li>
          <li>blur - Triggers when RTE is focused out.</li>
          <li>actionBegin - Triggers before command execution using toolbar items or executeCommand method.</li>
          <li>actionComplete - Triggers after command execution using toolbar items or executeCommand method.</li>
          <li>destroyed – Triggers when the component is destroyed.</li>
      </ul>
    </ng-template>
    </ejs-richtexteditor>`,
    providers: [ToolbarService, HtmlEditorService]
})
export class AppComponent  {
    public tools: object = {
        type: 'Expand',
        items: ['Bold', 'Italic', 'Underline', 'StrikeThrough',
    'FontName', 'FontSize', 'FontColor', 'BackgroundColor',
    'LowerCase', 'UpperCase', '|',
    'Formats', 'Alignments', 'OrderedList', 'UnorderedList',
    'Outdent', 'Indent', '|',
    'CreateLink', 'Image', '|', 'ClearFormat', 'Print',
    'SourceCode', 'FullScreen', '|', 'Undo', 'Redo']
    };
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RichTextEditorAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Multi-row Toolbar

Set the type as MultiRow in toolbarSettings to hide the overflowing items in the next row. All toolbar items are visible.

import { Component } from '@angular/core';
import { ToolbarService, HtmlEditorService } from '@syncfusion/ej2-angular-richtexteditor';
@Component({
    selector: 'app-root',
    template: `<ejs-richtexteditor id='defaultRTE' [toolbarSettings]='tools'>
    <ng-template #valueTemplate>
      <p>The Rich Text Editor triggers events based on its actions. </p>
      <p> The events can be used as an extension point to perform custom operations.</p>
      <ul>
        <li>created - Triggers when the component is rendered.</li>
        <li>change - Triggers only when RTE is blurred and changes are done to the content.</li>
        <li>focus - Triggers when RTE is focused in.</li>
        <li>blur - Triggers when RTE is focused out.</li>
        <li>actionBegin - Triggers before command execution using toolbar items or executeCommand method.</li>
        <li>actionComplete - Triggers after command execution using toolbar items or executeCommand method.</li>
        <li>destroyed – Triggers when the component is destroyed.</li>
      </ul>
    </ng-template>
    </ejs-richtexteditor>`,
    providers: [ToolbarService, HtmlEditorService]
})
export class AppComponent  {
    public tools: object = {
        type: 'MultiRow',
        items: ['Bold', 'Italic', 'Underline', 'StrikeThrough',
    'FontName', 'FontSize', 'FontColor', 'BackgroundColor',
    'LowerCase', 'UpperCase', '|',
    'Formats', 'Alignments', 'OrderedList', 'UnorderedList',
    'Outdent', 'Indent', '|',
    'CreateLink', 'Image', '|', 'ClearFormat', 'Print',
    'SourceCode', 'FullScreen', '|', 'Undo', 'Redo']
    };
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RichTextEditorAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Floating Toolbar

By default, the toolbar is floating at the top of the Rich Text Editor on scrolling. It can be customized by specifying the offset of the floating toolbar from document’s top position usingfloatingToolbarOffset.

Can Enable or disable the floating toolbar using enableFloating property.

import { Component, ViewChild } from '@angular/core';
import { ToolbarService, HtmlEditorService, QuickToolbarService, RichTextEditorComponent} from '@syncfusion/ej2-angular-richtexteditor';
import { CheckBoxComponent } from '@syncfusion/ej2-angular-buttons';
@Component({
    selector: 'app-root',
    template: `<ejs-richtexteditor #typeRTE id='defaultRTE' [toolbarSettings]='tools'>
    <ng-template #valueTemplate>
      <p>The Rich Text Editor triggers events based on its actions. </p>
      <p> The events can be used as an extension point to perform custom operations.</p>
      <ul>
        <li>created - Triggers when the component is rendered.</li>
        <li>change - Triggers only when RTE is blurred and changes are done to the content.</li>
        <li>focus - Triggers when RTE is focused in.</li>
        <li>blur - Triggers when RTE is focused out.</li>
        <li>actionBegin - Triggers before command execution using toolbar items or executeCommand method.</li>
        <li>actionComplete - Triggers after command execution using toolbar items or executeCommand method.</li>
        <li>destroyed – Triggers when the component is destroyed.</li>
      </ul>
    </ng-template>
    </ejs-richtexteditor>
     <div>
    <ejs-checkbox #float label="Enable Floating" [checked]="true" (change)="onChangeFloat()"></ejs-checkbox>
    </div>`,
    providers: [ToolbarService, HtmlEditorService, QuickToolbarService]
})
export class AppComponent  {
@ViewChild('float') rteFloatObj: CheckBoxComponent | undefined;
@ViewChild('typeRTE') rteObj: RichTextEditorComponent | undefined;
  public tools: object = {
      enableFloating: false
  };
  public onChangeFloat(): void {
      this.rteObj!.toolbarSettings.enableFloating = this.rteFloatObj!.checked;
      this.rteObj!.dataBind();
  }
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { AppComponent } from './app.component';
import { CheckBoxModule } from '@syncfusion/ej2-angular-buttons';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RichTextEditorAllModule,
        CheckBoxModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Toolbar Items

The following table shows that list of available tools in the Rich Text Editor’s toolbar.

Name Icons Summary Initialization
Undo Undo icon Allows to undo the actions. toolbarSettings: { items: [‘Undo’]}
Redo Redo icon Allows to redo the actions. toolbarSettings: { items: [‘Redo’]}
Alignment Alignment icon Align the content with left, center, and right margin. toolbarSettings: { items: [‘Alignments’]}
OrderedList OrderedList icon Create a new list item(numbered). toolbarSettings: { items: [‘OrderedList’]}
UnorderedList UnorderedList icon Create a new list item(bulleted). toolbarSettings: { items: [‘UnorderedList’]}
Indent Indent icon Allows to increase the indent level of the content. toolbarSettings: { items: [‘Indent’]}
Outdent Outdent icon Allows to decrease the indent level of the content. toolbarSettings: { items: [‘Outdent’]}
Hyperlink Hyperlink icon Creates a hyperlink to a text or image to a specific location in the content. toolbarSettings: { items: [‘CreateLink’]}
Images Images icon Inserts an image from an online source or local computer. toolbarSettings: { items: [‘Image’]}
LowerCase LowerCase icon Change the case of selected text to lower in the content. toolbarSettings: { items: [‘LowerCase’]}
UpperCase UpperCase icon Change the case of selected text to upper in the content. toolbarSettings: { items: [‘UpperCase’’]}
SubScript SubScript icon Makes the selected text as subscript (lower). toolbarSettings: { items: [‘SubScript’]}
SuperScript SuperScript icon Makes the selected text as superscript (higher). toolbarSettings: { items: [‘SuperScript’’]}
Print Print icon Allows to print the editor content. toolbarSettings: { items: [‘Print’]}
FontName FontName icon Defines the fonts that appear under the Font Family DropDownList from the Rich Text Editor’s toolbar. toolbarSettings: { items: [‘FontName’]}
FontSize FontSize icon Defines the font sizes that appear under the Font Size DropDownList from the Rich Text Editor’s toolbar. toolbarSettings: { items: [‘FontSize’]}
FontColor FontColor icon Specifies an array of colors can be used in the colors popup for font color. toolbarSettings: { items: [‘FontColor’]}
BackgroundColor BackgroundColor icon Specifies an array of colors can be used in the colors popup for background color. toolbarSettings: { items: [‘BackgroundColor’]}
Format Format icon An Object with the options that will appear in the Paragraph Format dropdown from the toolbar. toolbarSettings: { items: [‘Formats’]}
StrikeThrough StrikeThrough icon Apply double line strike through formatting for the selected text. toolbarSettings: { items: [‘StrikeThrough’]}
ClearFormat ClearFormat icon The clear format tool is useful to remove all formatting styles (such as bold, italic, underline, color, superscript, subscript, and more) from currently selected text. As a result, all the text formatting will be cleared and return to its default formatting styles. toolbarSettings: { items: [‘ClearFormat’]}
FullScreen FullScreen icon Stretches the editor to the maximum width and height of the browser window. toolbarSettings: { items: [‘FullScreen’]}
SourceCode SourceCode icon Rich Text Editor includes the ability for users to directly edit HTML code via “Source View”. If you made any modification in Source view directly, synchronize with Design view. toolbarSettings: { items: [‘SourceCode’]}
NumberFormatList NumberFormatList icon Allows to create list items with various list style types(numbered). toolbarSettings: { items: [‘NumberFormatList’]}
BulletFormatList BulletFormatList icon Allows to create list items with various list style types(bulleted). toolbarSettings: { items: [‘BulletFormatList’]}
JustifyLeft JustifyLeft icon Allows each line to begin at the same distance from the editor’s left-hand side. toolbarSettings: { items: [‘JustifyLeft’]}
JustifyCenter JustifyCenter icon There is an even space on each side of each line since the text is not aligned to the left or right margins. toolbarSettings: { items: [‘JustifyCenter’]}
JustifyRight JustifyRight icon Allows each line to end at the same distance from the editor’s right-hand side. toolbarSettings: { items: [‘JustifyRight’]}
JustifyFull JustifyFull icon The text is aligned with both right and left margins. toolbarSettings: { items: [‘JustifyFull’]}
Bold Bold icon Text that is thicker and darker than usual. toolbarSettings: { items: [‘Bold’]}
Italic Italic icon Shows a text that is leaned to the right. toolbarSettings: { items: [‘Italic’]}
Underline Underline icon The underline is added to the selected text. toolbarSettings: { items: [‘Underline’]}
ClearAll ClearAll icon Removes all styles that have been applied to the selected text. toolbarSettings: { items: [‘ClearAll’]}
Cut Cut icon Removes the text from its current location and places it into the clipboard. toolbarSettings: { items: [‘Cut’]}
Copy Copy icon The selected item is copied and pasted into the clipboard. toolbarSettings: { items: [‘Copy’]}
Paste Paste icon Allows you to insert a clipboard item into a specific location. toolbarSettings: { items: [‘Paste’]}
OpenLink OpenLink icon To open the URL link that is attached to the selected text. toolbarSettings: { items: [‘OpenLink’]}
EditLink EditLink icon Allows you to change the URL that has been attached to a specific item. toolbarSettings: { items: [‘EditLink’]}
CreateTable CreateTable icon Create a table with defined columns and rows. toolbarSettings: { items: [‘CreateTable’]}
RemoveTable RemoveTable icon Removes the selected table and its contents. toolbarSettings: { items: [‘TableRemove’]}
Replace Replace icon Replace the selected image with another image. toolbarSettings: { items: [‘Replace’]}
Align Alignment icon The image can be aligned to the right, left, or center. toolbarSettings: { items: [‘Align’]}
Remove Remove icon Allows to remove the selected image from the editor. toolbarSettings: { items: [‘Remove’]}
OpenImageLink OpenImageLink icon Opens the link that is attached to the selected image. toolbarSettings: { items: [‘OpenImageLink’]}
EditImageLink EditImageLink icon Allows to edit the link that is attached to the selected image. toolbarSettings: { items: [‘EditImageLink’]}
RemoveImageLink RemoveImageLink icon Removes the link that is attached to the selected image. toolbarSettings: { items: [‘RemoveImageLink’]}
InsertLink InsertLink icon Allows users to add a link to a particular item. toolbarSettings: { items: [‘InsertLink’]}
Display Display icon Allows you to choose whether an image should be shown inline or as a block. toolbarSettings: { items: [‘Display’]}
AltText AltText icon To display image description when an image on a Web page cannot be displayed. toolbarSettings: { items: [‘AltText’]}
Dimension Dimension icon Allows you to customize the image’s height and width. toolbarSettings: { items: [‘Dimension’]}
Maximize Maximize icon Stretches the editor to the maximum width and height of the browser window. toolbarSettings: { items: [‘Maximize’]}
Minimize Minimize icon Shrinks the editor to the default width and height. toolbarSettings: { items: [‘Minimize’]}
Preview Preview icon Allows to see how the editor’s content looks in a browser. toolbarSettings: { items: [‘Preview’]}
InsertCode InsertCode icon Represents preformatted text which is to be presented exactly as written in the HTML file. toolbarSettings: { items: [‘InsertCode’]}
RemoveLink RemoveLink icon Allows you to remove the applied link from the selected item. toolbarSettings: { items: [‘RemoveLink’]}
TableHeader TableHeader icon Allows you to add a table header. toolbarSettings: { items: [‘TableHeader’]}
TableColumns TableColumns icon Shows the dropdown to insert a column or delete the selected column. toolbarSettings: { items: [‘TableColumns’]}
TableRows TableRows icon Shows the dropdown to insert a row ors delete the selected row. toolbarSettings: { items: [‘TableRows’]}
TableCellHorizontalAlign TableCellHorizontalAlign icon Allows the table cell content to be aligned horizontally. toolbarSettings: { items: [‘TableCellHorizontalAlign’]}
TableCellVerticalAlign TableCellVerticalAlign icon Allows the table cell content to be aligned vertically. toolbarSettings: { items: [‘TableCellVerticalAlign’]}
TableEditProperties TableEditProperties icon Allows you to change the table width, padding, and cell spacing styles. toolbarSettings: { items: [‘TableEditProperties’]}

By default, tool will be arranged in following order.

items: ['Bold', 'Italic', 'Underline', '|', 'Formats', 'Alignments', 'OrderedList', 'UnorderedList','|', 'CreateLink', 'Image', '|', 'SourceCode', 'Undo', 'Redo']

The tools order can be customized as our application requirement. If you are not specifying any tools order, the editor will create the toolbar with default items.

Custom tool

The Rich Text Editor allows you to configure your own commands to its toolbar using the toolbarSettings property. The command can be plain text, icon, or HTML template. The order and the group can also be defined where the command should be included. Bind action to the command by getting its instance.

This sample shows how to add your own commands to the toolbar of the Rich Text Editor. The “Ω” command is added to insert special characters in the editor. By clicking the “Ω” command, it will show the special characters list, and then choose the character to be inserted in the editor.

The following code snippet illustrates custom tool with tooltip text which will be included in items field of the toolbarSettings property.

To get start quickly with Custom tool configuration in Angular Rich Text Editor component, refer to the video below.

In the following sample the Dialog component will be created in Rich Text Editor’s created event. And it’s target is given to Rich Text Editor’s content

{
    tooltipText: 'Insert Symbol',
    undo: true,
    click: this.onClick.bind(this),
    template: '<button class="e-tbar-btn e-btn" tabindex="-1" id="custom_tbar" style="width:100%"><div class="e-tbar-btn-text" style="font-weight: 500;"> &#937;</div></button>'
}
import { Component, ViewChild } from '@angular/core';
import { ToolbarService, LinkService, ImageService, HtmlEditorService, QuickToolbarService , RichTextEditorComponent, NodeSelection} from '@syncfusion/ej2-angular-richtexteditor';
import { Dialog } from '@syncfusion/ej2-popups';
@Component({
    selector: 'app-root',
    template: `<ejs-richtexteditor id='customRTE' #customRTE [toolbarSettings]='tools' (created)='onCreate()'>
            <ng-template #valueTemplate>
                <div style="display:block;"><p style="margin-right:10px">The custom
                command "insert special character" is configured as the last item of
                the toolbar.Click on the command and choose the special character you want
                to include from the popup.</p></div>
            </ng-template>
        </ejs-richtexteditor>
        <ejs-dialog #Dialog id="rteDialog" [buttons]='dlgButtons' (overlayClick)="dialogOverlay()" [header]='header' [visible]='false'
            [showCloseIcon]='false' [target]='target' (created)="dialogCreate()" [isModal]='true' [cssClass]='cssClass'>
            <ng-template #content>
                <div id="rteSpecial_char">
                    <div class="char_block" title="^">^</div>
                    <div class="char_block" title="_">_</div>
                    <div class="char_block" title="|">|</div>
                    <div class="char_block" title="¡">¡</div>
                    <div class="char_block" title="¢">¢</div>
                    <div class="char_block" title="£">£</div>
                    <div class="char_block" title="¤">¤</div>
                    <div class="char_block" title="¡">¡</div>
                    <div class="char_block" title="¢">¢</div>
                    <div class="char_block" title="£">£</div>
                    <div class="char_block" title="¤">¤</div>
                    <div class="char_block" title="¥">¥</div>
                    <div class="char_block" title="₹">₹</div>
                    <div class="char_block" title="¦">¦</div>
                    <div class="char_block" title="§">§</div>
                    <div class="char_block" title="¨">¨</div>
                    <div class="char_block" title="©">©</div>
                    <div class="char_block" title="ª">ª</div>
                    <div class="char_block" title="«">«</div>
                </div>
            </ng-template>
        </ejs-dialog>`,
    providers: [ToolbarService, LinkService, ImageService, HtmlEditorService, QuickToolbarService]
})
export class AppComponent  {
@ViewChild('customRTE')
public rteObj?: RichTextEditorComponent;
@ViewChild('Dialog')
public dialogObj?: Dialog;
public selection: NodeSelection = new NodeSelection();
public ranges?: Range;
public tools: object = {
    items: ['Bold', 'Italic', 'Underline', '|', 'Formats', 'Alignments', 'OrderedList',
    'UnorderedList', '|', 'CreateLink', 'Image', '|', 'SourceCode',
    {
        tooltipText: 'Insert Symbol',
        undo: true,
        click: this.onClick.bind(this),
        template: '<button class="e-tbar-btn e-btn" tabindex="-1" id="custom_tbar"  style="width:100%">'
                  + '<div class="e-tbar-btn-text" style="font-weight: 500;"> Ω</div></button>'
    }, '|', 'Undo', 'Redo'
    ]
};
public dlgButtons: any = [{ buttonModel: { content: "Insert", isPrimary: true }, click: this.onInsert.bind(this) },
{ buttonModel: { content: 'Cancel' }, click: this.dialogOverlay.bind(this) }];
public header: string = 'Special Characters';
public target: HTMLElement = document.getElementById('rteSection') as HTMLElement;
public height: any = '350px';
public onCreate(): void {
    let customBtn: HTMLElement = document.getElementById('custom_tbar') as HTMLElement;
    (this.dialogObj as any).target = document.getElementById('rteSection');
}
public dialogCreate(): void {
    let dialogCtn: HTMLElement = document.getElementById('rteSpecial_char') as HTMLElement;
    dialogCtn.onclick = (e: Event) => {
        let target: HTMLElement = e.target as HTMLElement;
        let activeEle: Element = this.dialogObj!.element.querySelector('.char_block.e-active') as Element;
        if (target.classList.contains('char_block')) {
            target.classList.add('e-active');
            if (activeEle) {
                activeEle.classList.remove('e-active');
            }
        }
    };
}

public onClick() {
    this.rteObj!.focusIn();
    this.ranges = this.selection.getRange(document);
    this.dialogObj!.width = this.rteObj!.element.offsetWidth * 0.5;
    this.dialogObj!.dataBind();
    this.dialogObj!.show();
    this.dialogObj!.element.style.maxHeight = 'none';
}

public onInsert(): void {
    let activeEle: Element = this.dialogObj!.element.querySelector('.char_block.e-active') as Element;
    if (activeEle) {
        this.ranges!.insertNode(document.createTextNode((activeEle as any).textContent));
    }
    this.dialogOverlay();
}

public dialogOverlay(): void {
    let activeEle: Element = this.dialogObj!.element.querySelector('.char_block.e-active') as Element;
    if (activeEle) {
        activeEle.classList.remove('e-active');
    }
    this.dialogObj!.hide();
}
public cssClass: String = "customClass e-rte-elements";
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { AppComponent } from './app.component';
import { DialogModule } from '@syncfusion/ej2-angular-popups';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RichTextEditorAllModule,
        DialogModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

The focus will be lost while rendering the required component for the custom toolbar, causing it to render outside the Rich Text Editor and triggering a blur event. During that time, proper functionality will not be achievable. Therefore, it is recommended to set the cssClass property or class as e-rte-elements in the dependency component.

Quick inline toolbar

Quick commands are opened as context-menu on clicking the corresponding element. The commands must be passed as string collection to image, text, and link attributes of the quickToolbarSettings property.

Target Element Default Quick Toolbar items
image ‘Replace’, ‘Align’, ‘Caption’, ‘Remove’, ‘InsertLink’, ‘Display’, ‘AltText’,’Dimension’.
link ‘Open’, ‘Edit’, ‘UnLink’.
text null
(Any toolbar items in the Rich Text Editor can be configured here).
table ‘tableHeader’, ‘tableRows’, ‘tableColumns’, ‘backgroundColor’, ‘-‘, ‘tableRemove’, ‘alignments’, ‘tableCellVerticalAlign’, ‘styles’.

Custom tool can be added to the corresponding quick toolbar, using quickToolbarSettings property.

The following sample demonstrates the option to insert the image to the Rich Text Editor content as well as option to rotate the image through the quick toolbar. The image rotation functionalities have been achieved through the toolbarClick event.

import { Component, ViewChild } from '@angular/core';
import { ToolbarService, LinkService, ImageService, HtmlEditorService,
QuickToolbarService, RichTextEditorComponent, QuickToolbarSettingsModel } from '@syncfusion/ej2-angular-richtexteditor';
@Component({
    selector: 'app-root',
    template: `<ejs-richtexteditor #imageRTE id='imageRTE' [quickToolbarSettings]='quickToolbarSettings' (quickToolbarSettingsChange)=' quickToolbarSettingsChange'>
            <ng-template #valueTemplate>
                <p>RichTextEditor allows to insert images from online source as well as local
                    computer where you want to insert the image in your content.</p>
                <p><b>Get started Quick Toolbar to click on the image</b></p>
                <p>It is possible to add custom style on the selected image inside the Rich Text Editor through quick toolbar.</p>
                <img id="rteImageID" style="width:300px; height:300px;transform: rotate(0deg);" alt="Logo" src="https://ej2.syncfusion.com/demos/src/rich-text-editor/images/RTEImage-Feather.png">
            </ng-template>
        </ejs-richtexteditor>`,
    providers: [ToolbarService, LinkService, ImageService, HtmlEditorService, QuickToolbarService]
})
export class AppComponent  {
    @ViewChild('imageRTE') rteObj: RichTextEditorComponent | undefined;
    quickToolbarSettings: QuickToolbarSettingsModel = {
        image: [
            'Replace', 'Align', 'Caption', 'Remove', 'InsertLink', 'OpenImageLink', '-',
            'EditImageLink', 'RemoveImageLink', 'Display', 'AltText', 'Dimension'
        ]
    };
    quickToolbarSettingsChange: QuickToolbarSettingsModel={}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RichTextEditor, RichTextEditorAllModule } from '@syncfusion/ej2-angular-richtexteditor';
import { ButtonModule } from '@syncfusion/ej2-angular-buttons';
import { DropDownListComponent } from '@syncfusion/ej2-angular-dropdowns';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        ButtonModule,
        RichTextEditorAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

import 'zone.js';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

To use quick toolbar feature, inject QuickToolbarService, ImageService, LinkService in the provider section of AppModule.