Introducing Angular Rich Text Editor in Essential JS 2 | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (175).NET Core  (29).NET MAUI  (208)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (220)BoldSign  (15)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (67)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (101)Streamlit  (1)Succinctly series  (131)Syncfusion  (920)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (37)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (151)Chart  (132)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (633)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (41)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (508)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (11)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (597)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Introducing Angular Rich Text Editor in Essential JS 2

As you may have noticed, major improvements have been made in Essential JS 2 for Angular in our 2018 Vol. 2 release. In this post, I am glad to introduce our WYSWIG Angular rich text editor (preview), which was one of the most requested components.

The WYSWIG editor feature helps to format content and show an instant preview. The key features of rich text editor are the HTML editor, markdown editor, quick toolbar, inline mode, and formatting styles. It has been built to be lightweight, modular, and responsive. It is available for JavaScript, Angular, React, Vue, ASP.NET MVC, and ASP.NET Core platforms.

This blog post will showcase some key features of the rich text editor component in Angular.

HTML editor

The rich text editor (RTE) has built-in support for an HTML editor, which is used to create, edit, and format content and returns valid HTML markup. Adding RTE to your application is very easy as most of the common features are enabled by default and configured as follows:

import { Component } from '@angular/core';
import { ToolbarService, HtmlEditorService } from '@syncfusion/ej2-ng-richtexteditor';

@Component({
  selector: 'my-app',
  template: `<ejs-richtexteditor id='defaultRTE' [(value)]='value'></ejs-richtexteditor>`,
  providers: [ToolbarService, HtmlEditorService]
})
export class AppComponent {
  name = 'Angular';
  
  public value: string = `<h3>Essential JS 2</h3>
<p>Essential JS 2 for Angular is a modern JavaScript UI toolkit that has been built from the ground up to be lightweight, responsive, modular and touch friendly. It is written in TypeScript and has no external dependencies. It comes with full documentation and support and is available under commercial and community licenses - please visit <a href="http://www.syncfusion.com/" rel="nofollow" target="_blank">www.syncfusion.com</a> to get started.</p>`;
}

HTML editor

For more information, please visit our documentation page.

Markdown editor

The rich text editor component has markdown editing support that helps you display markdown content and format it. If you want to have an instant preview of the formatting, integrate third-party libraries like marked, which converts markdown into HTML to achieve the preview functionality. You can also easily configure custom tags for markdown formatting (e.g., add ‘+’ tags instead of “-“).

The following tags are allowed with markdown editor:

  • Heading tags
  • Blockquote
  • Code
  • Paragraph
  • Ordered and unordered list
  • Bold, italic, strikethrough
  • Subscript and superscript
  • Uppercase and lowercase

The markdown editor can be configured in Angular as follows:

import { Component } from '@angular/core';
import { ToolbarService, MarkdownEditorService } from '@syncfusion/ej2-ng-richtexteditor';

@Component({
  selector: 'my-app',
  template: `<ejs-richtexteditor id='defaultRTE' [(value)]='value' editorMode='Markdown' [toolbarSettings]='tools'></ejs-richtexteditor>`,
  providers: [ToolbarService,MarkdownEditorService]
})
export class AppComponent {
  name = 'Angular';
  public tools: object = {
    items: ['Bold', 'Italic', 'StrikeThrough', '|',
    'Formats', 'OrderedList', 'UnorderedList', '|',
    'CreateLink', 'Image', '|','Undo', 'Redo']
};
  public value: string = `# Essential JS 2
  Essential JS 2 for Angular is a modern JavaScript UI toolkit that has been built from the ground up to be lightweight, responsive, modular and touch friendly. It is written in TypeScript and has no external dependencies. It comes with full documentation and support and is available under commercial and community licenses - please visit [www.syncfusion.com](http://www.syncfusion.com/) to get started.`;
}

Markdown editor

For a complete list of markdown functionality and its configuration, see this documentation section.

Customizable toolbar

By default, the rich text editor’s toolbar has standard toolbar commands for the most common actions. It also allows you to customize commands for changing the display order, adding or removing built-in commands, and adding custom commands. The overflowing toolbar items can be controlled by multirow or expand mode.

Toolbar with customized commands

More information about how to use this toolbar can be found in this documentation page.

Quick toolbar

When selecting content, images, or links, the quick toolbar will be displayed with configured options. This feature helps developers show the contextual actions right on top of the content. Also, it is possible to customize whether the quick toolbar displays when scrolling the content.

Image - quick toolbar

 

Inline mode

The editor is capable of handling editing content in place, which helps you edit content on the same page, such as in content management-related applications. The editor’s toolbar becomes visible on editing the content dynamically. It can be customized to display on selection of content or when content is clicked.

The editor with inline mode

 

Formatting styles

The editor provides the following options to edit and format the content:

  • Use various heading tags.
  • Format the text for quotes or code.
  • Change the text background and font color.
  • Change the text format to bold, italic, underline, or strikethrough.
  • Change the text’s font family and size.
  • Align text to left, right, center, or justify it.
  • Increase or decrease the indent spacing.
  • Format text to superscript or subscript.

Toolbar with formatting commands

Working with images

Along with content, you are able to insert images from local and remote server locations with captions. The upload feature supports uploading new images as blobs and inserting them into the content. The quick toolbar can be shown on selecting an image with preconfigured commands, which helps you manage images. The editor provides the following options to manage images:

  • Hyperlink images.
  • Remove images.
  • Replace images with new images.
  • Add alternative text to images to be displayed if the images don’t load.
  • Align the image to the left, right, or center.
  • Change the image’s display size.
  • Rotate images.

Insert image dialog

For more information about how to manage images, refer to this documentation section.

Working with links

The editor has necessary options to insert or remove hyperlinks within content. The following options are available to work with hyperlinks:

  • Insert, edit, or remove a hyperlink.
  • Specify display text for links.
  • Configure “Open in New Window” option to choose whether the link can be opened in a new window.
  • Specify tooltip text to be displayed on mouse hover, which helps to meet accessibility standards.

Quick toolbar also can be applied to links with custom commands. The editor automatically converts hyperlinks when entering the URL.

Edit link dialog

Working with lists

The editor has support to insert ordered (numbered) or unordered (bulleted) lists.

Highlighted list and its commands

Source code view

Built-in support available to display HTML source code of content being editing. This helps advanced users update the source code directly.

Source code view

Other features

There are several other helpful features in this rich text editor component:

  • Preview: Preview the modified content before saving it in markdown.
  • Print: Print all the content with its styles.
  • Full screen: Edit content by maximizing scaling to a browser window.
  • Clipboard operations: Use clipboard operations (cut, copy, and paste).
  • Characters count: Calculate content length.
  • Third-party integration: Integrate third-party libraries such as code mirror, marked, etc.
  • Undo/Redo: Undo history to a custom level.
  • Validation: Work with HTML forms, template-driven forms, and reactive forms.
  • Iframe mode: Use an iframe-based editor.

What’s next

We have included most of the common requirements and have implemented them with modular architecture in this RTE. So the rich set of features should not hinder you, as you can configure just the features you need and maintain the size of rich text editor to a high degree.

We look forward to you trying RTE out and providing your feedback. If you don’t have a license, try our rich text editor component’s features by downloading our free trial. You can also explore our online demo and our documentation.

Open source

You can check out the source of our Angular rich text editor on GitHub, too, at https://github.com/syncfusion/ej2-angular-ui-components/tree/master/components/richtexteditor. If you have any questions or feedback, please let us know in the comments below. You can also contact us through our support forum or Direct-Trac.

 

If you like this blog post, we think you’ll also like the following free e-books:

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed