Search results

Third-Party Integration

The RichTextEditor can be integrated with third-party to suite the application scenario.

CodeMirror Integration

RichTextEditor comes with a basic HTML source editor through the view-source property. CodeMirror plugin can be used to highlight the syntax of HTML. CodeMirror plugin for RichTextEditor makes editing of HTML source code with a pleasant experience.

Import necessary CSS and JS files of CodeMirror to the HTML page.

Required JS files of code mirror.

 <script src="scripts/CodeMirror/codemirror.js" type="text/javascript"></script>
 <script src="scripts/CodeMirror/javascript.js" type="text/javascript"></script>
 <script src="scripts/CodeMirror/css.js" type="text/javascript"></script>
 <script src="scripts/CodeMirror/htmlmixed.js" type="text/javascript"></script>

Required CSS file of code mirror

 <link href="scripts/CodeMirror/codemirror.min.css" rel="stylesheet" />

Add a custom icon for HTML source editor in the toolbar of RichTextEditor using the template option of ToolbarSettings, define the code mirror plugins, and then pass the RichTextEditor content as argument in the actionComplete event.

  <ejs-richtexteditor ref="rteObj" :value="value" :toolbarSettings="toolbarSettings" :actionComplete="actionCompleteHandler" :showCharCount="showCharCount" :maxLength="maxLength"></ejs-richtexteditor>

  import Vue from "vue";
  import { Browser, addClass, removeClass } from "@syncfusion/ej2-base";
  import { RichTextEditorPlugin, Toolbar, Link, Image, Count, HtmlEditor, QuickToolbar } from "@syncfusion/ej2-vue-richtexteditor";


  export default {
    data: function() {
      return {
        showCharCount: true,
        myCodeMirror: '',
        value: `<p>The rich text editor component is WYSIWYG ("what you see is what you get") editor that provides the best user experience to create and update the content. Users can format their content using standard toolbar commands.</p>
          <p><b>Key features:</b></p>
              <p>Provides &lt;IFRAME&gt; and &lt;DIV&gt; modes</p>
              <p>Capable of handling markdown editing.</p>
              <p>Contains a modular library to load the necessary functionality on demand.</p>
              <p>Provides a fully customizable toolbar.</p>
              <p>Provides HTML view to edit the source directly for developers.</p>
              <p>Supports third-party library integration.</p>
              <p>Allows preview of modified content before saving it.</p>
              <p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
              <p>Contains undo/redo manager.</p>
              <p>Creates bulleted and numbered lists.</p>
        maxLength: 2000,
        toolbarSettings: {
          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'
    methods: {
      mirrorConversion: function(e) {
        var textArea = this.$refs.rteObj.ej2Instances.contentModule.getEditPanel();
        var id = this.$refs.rteObj.getID() +  'mirror-view';
        var mirrorView = this.$refs.rteObj.$el.querySelector('#' + id);
        var charCount = this.$refs.rteObj.$el.querySelector('.e-rte-character-count');
        if (e.targetItem === 'Preview') {
 = 'block';
 = 'none';
          textArea.innerHTML = this.myCodeMirror.getValue();
 = 'block';
        } else {
          if (!mirrorView) {
            mirrorView = document.createElement('div', { className: 'e-content' });
   = id;
          } else {
            mirrorView.innerHTML = '';
 = 'none';
 = 'block';
          this.renderCodeMirror(mirrorView, this.$refs.rteObj.ej2Instances.value);
 = 'none';
      renderCodeMirror: function(mirrorView, content) {
        this.myCodeMirror = CodeMirror(mirrorView, {
          value: content,
          lineNumbers: true,
          mode: 'text/html',
          lineWrapping: true,
      actionCompleteHandler: function(e) {
        if (e.targetItem && (e.targetItem === 'SourceCode' || e.targetItem === 'Preview')) {
          this.$refs.rteObj.ej2Instances.sourceCodeModule.getPanel().style.display = 'none';
        else {
          var proxy = this;
          setTimeout(function () {
          }, 400);
      richtexteditor:[Toolbar, Link, Image, Count, HtmlEditor, QuickToolbar]

@import "../../node_modules/@syncfusion/ej2-vue-base/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-richtexteditor/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-lists/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-navigations/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-popups/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-splitbuttons/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-buttons/styles/material.css";
@import "../../node_modules/@syncfusion/ej2-vue-inputs/styles/material.css";

  .e-code-mirror::before {
    content: '\e345';

  .e-html-preview::before {
    content: '\e350';

  .CodeMirror-gutters {
    display: none;