Quick Toolbars in TypeScript Rich Text Editor

The Rich Text Editor has quick toolbars that act as context-menus, appearing when you click on elements like images, links, audio, video, and tables. By default, specific quick toolbar items are displayed when clicking on the corresponding element. You can customize these items using the quickToolbarSettings property.

Rich Text Editor features are segregated into individual feature-wise modules. To use quick toolbar features, inject the quick toolbar module using the RichTextEditor.Inject(QuickToolbar).

Prerequisites

Before using the quick toolbar, ensure the Syncfusion theme CSS is imported in your application. For example, with Tailwind 3:

@import '../node_modules/@syncfusion/ej2-base/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-lists/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-navigations/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css';
@import '../node_modules/@syncfusion/ej2-richtexteditor/styles/tailwind3.css';

Image quick toolbar

You can customize the quick toolbar options for images using the image property within the quickToolbarSettings. The Rich Text Editor provides essential tools such as Replace, Align, WrapText, Caption, Remove, InsertLink, OpenImageLink, EditImageLink, RemoveImageLink, Display, AltText, and Dimension allowing you to manage and edit images directly within the content.

By configuring these options in the quickToolbarSettings property, you can enhance the editor’s functionality, ensuring a user-friendly experience for efficiently handling image elements.

The link quick toolbar appears when you click on a link in the editor. You can customize its items using the link property in the quickToolbarSettings.

The Rich Text Editor provides essential tools in the link quick toolbar, including Open, Edit, and Remove. You can also add a custom tool.

The following example demonstrates how to customize the link quick toolbar using the quickToolbarSettings property.

Table quick toolbar

The table quick toolbar opens when you click anywhere within a table. Customize its items using the table property in the quickToolbarSettings.

The Rich Text Editor provides essential tools in the table quick toolbar, such as TableHeader, TableRemove, TableRows, TableColumns, TableCell, Styles, BackgroundColor, Alignments, TableCellVerticalAlign, TableEditProperties, and TableCellProperties.

The following sample demonstrates the customization of table quick toolbar.

Audio quick toolbar

Customize the quick toolbar items for audio elements using the audio property in the quickToolbarSettings. The Rich Text Editor provides essential tools such as AudioReplace, Remove, and AudioLayoutOption for managing audio content.

By configuring these options in the quickToolbarSettings property, you can customize how users handle audio elements.

Video quick toolbar

The video quick toolbar appears when you click on a video element. You can customize its tools using the video property in the quickToolbarSettings.

The Rich Text Editor allows you to tailor the video quick toolbar with essential tools such as VideoReplace, VideoAlign, VideoRemove, VideoLayoutOption, and VideoDimension for managing embedded videos.

By configuring these options in the quickToolbarSettings property, you can customize how users edit and manage video elements.

Text quick toolbar

The text quick toolbar provides easy access to commonly used formatting tools, enabling users to apply styles and adjustments effortlessly. This enhances the editing experience by streamlining text formatting.

Customize the quick toolbar items using the text property in the quickToolbarSettings. Any toolbar items available in the Rich Text Editor can be configured for the text quick toolbar. By default, the text quick toolbar is null. The example below demonstrates its customization.

Render quick toolbar in document body

To render the quick toolbar in the document body, set enableAppendToBody to true in quickToolbarSettings. The default value is false. This prevents the toolbar from being clipped in constrained layouts, such as when the editor’s dimensions are very small.

The following example demonstrates how to render the quick toolbar directly in the document body using enableAppendToBody in quickToolbarSettings.