RichTextEditorComponent
23 Sep 202524 minutes to read
RichTextEditor represents the react RichTextEditor.
<RichTextEditor/>
Properties
autoSaveOnIdle boolean
Enables or disables the auto-save option, which performs the save action during idle states after content changes.
If enabled, the editor will save content in idle state based on the saveInterval property’s value.
The change event is triggered if the content has been modified since the last saved state.
Defaults to false
backgroundColor BackgroundColorModel
Defines the color palette for the background color (text highlight color) toolbar command.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const toolbarSettings = {
items: ['BackgroundColor'],
};
const backgroundColor = {
columns: 2,
colorCode: {
Custom: [
'#ffff00',
'#008000',
'#800080',
'#800000',
'#808000',
'#c0c0c0',
'#000000',
'',
],
},
showRecentColors: true,
modeSwitcher: false
};
return (
<div >
<RichTextEditorComponent toolbarSettings={toolbarSettings} backgroundColor={backgroundColor}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {columns: 5,modeSwitcher: false,showRecentColors: true,colorCode: {‘Custom’: [‘#ffff00’, ‘#00ff00’, ‘#00ffff’, ‘#ff00ff’, ‘#0000ff’, ‘#ff0000’,’#000080’, ‘#008080’, ‘#008000’, ‘#800080’, ‘#800000’, ‘#808000’,’#c0c0c0’, ‘#000000’, ‘’]}}
bulletFormatList BulletFormatListModel
Predefines advanced list types that populate the bulletFormatList dropdown in the toolbar.
Defaults to {types: [{ text: ‘None’, value: ‘none’ },{ text: ‘Disc’, value: ‘disc’ },{ text: ‘Circle’, value: ‘circle’ },{ text: ‘Square’, value: ‘square’ }]}
codeBlockSettings CodeBlockSettingsModel
Predefines advanced list types that populate the code block dropdown in the toolbar.
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Table, Toolbar, CodeBlock } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let toolbarSettings: object = {
items: ['Undo', 'Redo', '|', 'CodeBlock', '|', 'Bold', 'Italic', 'Underline', 'StrikeThrough', 'InlineCode', '|', 'CreateLink', 'Image', 'CreateTable', 'Blockquote', '|', 'BulletFormatList', 'NumberFormatList', '|', 'Formats', 'Alignments', '|', 'Outdent', 'Indent', '|',
'FontColor', 'BackgroundColor', 'FontName', 'FontSize', '|', 'LowerCase', 'UpperCase', '|', 'EmojiPicker', '|', 'SourceCode']
};
let codeBlockSettings = {
languages: [
{ label: "HTML", language: "html" },
{ label: "JavaScript", language: "javascript" },
{ label: "CSS", language: "css" },
{ label: "Plain Text", language: "plaintext" }
],
defaultLanguage: "plaintext"
};
let placeholder = 'Type something...';
return (
<RichTextEditorComponent toolbarSettings={toolbarSettings} codeBlockSettings={codeBlockSettings} placeholder={placeholder}>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar, Table, CodeBlock]} />
</RichTextEditorComponent>
);
}
Defaults to {defaultLanguage: ‘plaintext’,languages: [{ language: ‘plaintext’, label: ‘Plain text’ },{ language: ‘c’, label: ‘C’ },{ language: ‘csharp’, label: ‘C#’ },{ language: ‘cpp’, label: ‘C++’ },{ language: ‘css’, label: ‘CSS’ },{ language: ‘diff’, label: ‘Diff’ },{ language: ‘html’, label: ‘HTML’ },{ language: ‘java’, label: ‘Java’ },{ language: ‘javascript’, label: ‘JavaScript’ },{ language: ‘php’, label: ‘PHP’ },{ language: ‘python’, label: ‘Python’ },{ language: ‘ruby’, label: ‘Ruby’ },{ language: ‘sql’, label: ‘SQL’ },{ language: ‘typescript’, label: ‘TypeScript’ },{ language: ‘xml’, label: ‘XML’ }]}
cssClass string
Specifies the CSS class name appended to the root element of the RichTextEditor.
Multiple custom CSS classes can be added.
Defaults to null
editorMode EditorMode
Defines the mode of the RichTextEditor.
-
HTML: Render as an HTML editor using an<IFRAME>, content editable<div>, or<textarea>. -
Markdown: Render as a Markdown editor using a<textarea>.
Defaults to ‘HTML’
emojiPickerSettings EmojiSettingsModel
Configures emoji picker options in the Rich Text Editor.
Properties:
- iconsSet: Array representing emoji icons.
- showSearchBox: Enables/disables the search box.
enableAutoUrl boolean
Enable enableAutoUrl to accept the given URL (relative or absolute) without validating the URL for hyperlinks.
Otherwise, the given URL will automatically convert to an absolute path URL by prefixing it with https:// for hyperlinks.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div >
<RichTextEditorComponent enableAutoUrl={true}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}/>
</RichTextEditorComponent>
</div>
);
}
Defaults to false
enableHtmlEncode boolean
Determines if source code should be displayed in an encoded format.
Defaults to false
enableHtmlSanitizer boolean
Indicates whether to allow cross-site scripting (XSS) or not.
Defaults to true
enablePersistence boolean
Enables or disables the persistence of the component’s state between page reloads.
If enabled, the value of the Rich Text Editor is retained.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent enablePersistence={true}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to false
enableResize boolean
Enables or disables the resizing option in the editor.
When enabled, the editor can be resized by dragging the resize icon in its bottom right corner.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, Resize } from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent enableResize={true}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, Resize]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to false
enableRtl boolean
Enable or disable rendering component in right to left direction.
Defaults to false
enableTabKey boolean
Allows the tab key action in the Rich Text Editor content.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, Resize } from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent enableTabKey={true}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, Resize]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to false
enableXhtml boolean
Indicates whether XHTML is enabled or not.
Defaults to false
enabled boolean
Indicates whether the component is enabled or disabled.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent enabled={true}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to true
enterKey EnterKey
Specifies the tag to be inserted when the enter key is pressed.
-
P: Pressing enter inserts aptag. The default value will be<p><br></p>. -
DIV: Inserts adivtag instead of the defaultPtag. -
BR: Inserts abrtag instead of the defaultPtag.
Defaults to ‘P’
exportPdf ExportPdfModel
Describes file export options to PDF in the Rich Text Editor, such as:
-
serviceurl: URL used for exporting content to PDF format. -
fileName: Specifies the default PDF file name upon export. -
stylesheet: Applies a stylesheet to the exported PDF file.
Defaults to { serviceUrl: null, fileName: ‘Sample.pdf’, stylesheet: null}
exportWord ExportWordModel
Defines file export options for the Rich Text Editor with properties like:
-
serviceurl: The URL utilized for exporting editor content to Word files. -
fileName: Designates the default name for exported Word files. -
stylesheet: Applies a stylesheet to the exported Word file.
Defaults to { serviceUrl: null, fileName: Sample.docx, stylesheet: null}
fileManagerSettings FileManagerSettingsModel
Defines image manager options in the Rich Text Editor with the following attributes:
-
enable: Boolean to enable or disable the image manager. -
ajaxSettings: Configures AJAX settings for image handling. -
contextMenuSettings: Manages context menu availability and options. -
navigationPaneSettings: Sets up the navigation pane display and contents. -
toolbarSettings: Specifies toolbar configuration and visible items. -
uploadSettings: Manages upload-specific configurations.
| Defaults to *{ enable: false, path: ‘/’, ajaxSettings: { getImageUrl: null, url: null, uploadUrl: null }, contextMenuSettings: { visible: true, file: [‘Open’, ‘ | ’, ‘Cut’, ‘Copy’, ‘ | ’, ‘Delete’, ‘Rename’, ‘ | ’, ‘Details’], folder: [‘Open’, ‘ | ’, ‘Cut’, ‘Copy’, ‘Paste’, ‘ | ’, ‘Delete’, ‘Rename’, ‘ | ’, ‘Details’], layout: [‘SortBy’, ‘View’, ‘Refresh’, ‘ | ’, ‘Paste’, ‘ | ’, ‘NewFolder’, ‘Upload’, ‘ | ’, ‘Details’, ‘ | ’, ‘SelectAll’] }, navigationPaneSettings: { visible: true, items: [‘NewFolder’, ‘Upload’, ‘Cut’, ‘Copy’, ‘Paste’, ‘Delete’, ‘Download’, ‘Rename’, ‘SortBy’, ‘Refresh’, ‘Selection’, ‘View’, ‘Details’] }, toolbarSettings: { visible: true, items: [‘Upload’, ‘NewFolder’] }, uploadSettings: { autoUpload: true, minFileSize: 0, maxFileSize: 30000000, allowedExtensions: ‘’, autoClose: false }}* |
floatingToolbarOffset number
Keeps the toolbar fixed at the top of the Rich Text Editor during scrolling and specifies the
toolbar’s offset from the document’s top position.
Defaults to 0
fontColor FontColorModel
Defines the color palette for the font color toolbar command.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tools = {items: [ 'FontColor']}
const fontColor = {
columns: 2,
colorCode: {'Custom': ['#ffff00', '#008000', '#800080', '#800000', '#808000', '#c0c0c0', '#000000','']},
showRecentColors: true,
modeSwitcher: false
}
return (
<div>
<RichTextEditorComponent toolbarSettings={tools} fontColor={fontColor}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {columns: 10,modeSwitcher: false,showRecentColors: true,colorCode: {‘Custom’: [’’, ‘#000000’, ‘#e7e6e6’, ‘#44546a’, ‘#4472c4’, ‘#ed7d31’, ‘#a5a5a5’, ‘#ffc000’, ‘#70ad47’, ‘#ff0000’,’#f2f2f2’, ‘#808080’, ‘#cfcdcd’, ‘#d5dce4’, ‘#d9e2f3’, ‘#fbe4d5’, ‘#ededed’, ‘#fff2cc’, ‘#e2efd9’, ‘#ffcccc’,’#d9d9d9’, ‘#595959’, ‘#aeaaaa’, ‘#acb9ca’, ‘#b4c6e7’, ‘#f7caac’, ‘#dbdbdb’, ‘#ffe599’, ‘#c5e0b3’, ‘#ff8080’,’#bfbfbf’, ‘#404040’, ‘#747070’, ‘#8496b0’, ‘#8eaadb’, ‘#f4b083’, ‘#c9c9c9’, ‘#ffd966’, ‘#a8d08d’, ‘#ff3333’,’#a6a6a6’, ‘#262626’, ‘#3b3838’, ‘#323e4f’, ‘#2f5496’, ‘#c45911’, ‘#7b7b7b’, ‘#bf8f00’, ‘#538135’, ‘#b30000’,’#7f7f7f’, ‘#0d0d0d’, ‘#161616’, ‘#212934’, ‘#1f3763’, ‘#823b0b’, ‘#525252’, ‘#7f5f00’, ‘#375623’, ‘#660000’]}}
fontFamily FontFamilyModel
Predefines font families that populate the font family dropdown in the toolbar.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tools = {items: [ 'FontName']}
const fontFamily = {
default: "Segoe UI",
width: "65px",
items: [{ text: "Segoe UI", value: "Segoe UI" }]
};
return (
<div>
<RichTextEditorComponent toolbarSettings={tools} fontFamily={fontFamily}>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {default: ‘Segoe UI’,width: ‘65px’,items: [{ text: ‘Segoe UI’, value: ‘Segoe UI’ },{ text: ‘Arial’, value: ‘Arial,Helvetica,sans-serif’ },{ text: ‘Courier New’, value: ‘Courier New,Courier,monospace’ },{ text: ‘Georgia’, value: ‘Georgia,serif’ },{ text: ‘Impact’, value: ‘Impact,Charcoal,sans-serif’ },{ text: ‘Lucida Console’, value: ‘Lucida Console,Monaco,monospace’ },{ text: ‘Tahoma’, value: ‘Tahoma,Geneva,sans-serif’ },{ text: ‘Times New Roman’, value: ‘Times New Roman,Times,serif’ },{ text: ‘Trebuchet MS’, value: ‘Trebuchet MS,Helvetica,sans-serif’ },{ text: ‘Verdana’, value: ‘Verdana,Geneva,sans-serif’ }]}
fontSize FontSizeModel
Defines the predefined font sizes that populate the font size dropdown in the toolbar.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tools = { items: [ 'FontSize']}
const fontSize = {
default: '10pt',
width: '35px',
items: [ { text: '8', value: '8pt' },{ text: '10', value: '10pt' } ]
}
return (
<div>
<RichTextEditorComponent toolbarSettings={tools} fontSize={fontSize}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {default: ‘10pt’,width: ‘35px’,items: [{ text: ‘8’, value: ‘8pt’ },{ text: ‘10’, value: ‘10pt’ },{ text: ‘12’, value: ‘12pt’ },{ text: ‘14’, value: ‘14pt’ },{ text: ‘18’, value: ‘18pt’ },{ text: ‘24’, value: ‘24pt’ },{ text: ‘36’, value: ‘36pt’ }]}
format FormatModel
Predefines a collection of paragraph styles along with quote and code styles
that populate the format dropdown in the toolbar.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tools = { items: [ 'Formats'] }
const format = {
default: 'Paragraph',
width:'65px',
types: [
{ text: 'Paragraph', value: 'P'},
{ text: 'Heading 1', value: 'H1' },
{ text: 'Heading 2', value: 'H2' },
{ text: 'Heading 3', value: 'H3' },
{ text: 'Heading 4', value: 'H4' },
{ text: 'Heading 5', value: 'H5' },
{ text: 'Heading 6', value: 'H6' },
{ text: 'Preformatted', value: 'Pre' },
]
}
return (
<div>
<RichTextEditorComponent toolbarSettings={tools} Format={format}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {default: ‘Paragraph’,width: ‘65px’,types: [{ text: ‘Paragraph’, value: ‘P’},{ text: ‘Heading 1’, value: ‘H1’ },{ text: ‘Heading 2’, value: ‘H2’ },{ text: ‘Heading 3’, value: ‘H3’ },{ text: ‘Heading 4’, value: ‘H4’ },{ text: ‘Heading 5’, value: ‘H5’ },{ text: ‘Heading 6’, value: ‘H6’ },{ text: ‘Preformatted’, value: ‘Pre’ }]}
formatPainterSettings FormatPainterSettingsModel
Configures the format painter options in the Rich Text Editor.
Properties:
- allowedFormats: Tags selectors that allow format copying.
- deniedFormats: Tag selectors that prevent format copying.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, FormatPainter} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tools = { items: ['FormatPainter']}
const formatPainterSettings = {
allowedFormats: 'span; strong;',
deniedFormats: 'span(important)'
};
return (
<div>
<RichTextEditorComponent toolbarSettings={tools} formatPainterSettings={formatPainterSettings}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, FormatPainter]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {allowedFormats: ‘b; em; font; sub; sup; kbd; i; s; u; code; strong; span; p; div; h1; h2; h3; h4; h5; h6; blockquote; ol; ul; li; pre;’,deniedFormats: null}
formatter IFormatter
Customize the keyCode to change the key value.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent formatter={null} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to null
height string|number
Specifies the height of the Rich Text Editor component.
Defaults to “auto”
htmlAttributes { : }
Allows specifying additional HTML attributes like title, name, etc.
Accepts multiple attributes in a key-value pair format.
Defaults to {}
iframeSettings IFrameSettingsModel
Configures iframe mode items in the Rich Text Editor.
Properties:
- enable: Boolean to place editor content in an iframe, isolating it from the page.
- attributes: Custom style for displaying content inside the iframe. Applied to iframe body.
- resources: Adds styles and scripts to the iframe.
- styles[]: Array of CSS files for the iframe content.
- scripts[]: Array of JS script files for the iframe.
- metaTags[]: Array of meta tags for iframe’s head, setting metadata (http-equiv, charset, etc.).
- sandbox: String array defining iframe sandbox attributes, controlling security restrictions. Default includes “allow-same-origin”.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const iframe = {enable:true}
return (
<div>
<RichTextEditorComponent iframeSettings={iframe} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {enable: false,attributes: null,resources: { styles: [], scripts: [] },metaTags: [],sandbox: null,}
importWord ImportWordModel
Configures the options for importing Word files in the Rich Text Editor component.
The serviceUrl property specifies the server endpoint URL where the uploaded Word file will be processed.
Defaults to { serviceUrl: null}
inlineMode InlineModeModel
Configures the inline edit mode for the Rich Text Editor with the following options:
-
enable: A boolean value to enable or disable the inline edit mode. -
onSelection: Determines how the toolbar is activated:- If set to
true, the toolbar appears inline upon text selection. - If set to
false, the toolbar opens when clicking on the target element.
- If set to
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const inline = {enable:true, onselection:true}
return (
<div>
<RichTextEditorComponent inlineMode={inline} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to { enable: false, onSelection: true}
insertAudioSettings AudioSettingsModel
Defines the options for inserting audio files in the Rich Text Editor, including properties such as:
-
allowedTypes: Specifies the file extensions for audio files allowed to be inserted, listed as a comma-separated string (e.g., ‘.wav’, ‘.mp3’). -
layoutOption: Sets the default layout for audio files when inserted into the Rich Text Editor. The options are ‘Inline’ and ‘Break’. -
saveFormat: Determines the format used to store audio files in the Rich Text Editor, either ‘Base64’ or ‘Blob’.Choose ‘Base64’ for frequently inserted small audio files without the need for a specific storage location.
-
saveUrl: Provides the service URL responsible for handling audio file uploads and storage on the server. -
path: Specifies the storage path for audio files and the reference for displaying them. -
maxFileSize: Sets the maximum file size allowed for audio file uploads.
Defaults to { allowedTypes: [‘.wav’, ‘.mp3’, ‘.m4a’, ‘.wma’], layoutOption: ‘Inline’, saveFormat: ‘Blob’, saveUrl: null, path: null, maxFileSize: 30000000}
insertImageSettings ImageSettingsModel
Specifies the options for inserting images in the Rich Text Editor. Includes properties such as:
-
allowedTypes: Specifies the allowed image file extensions as a comma-separated list (e.g., ‘.jpg’, ‘.png’). -
display: Sets the default display mode for an inserted image, either ‘inline’ or ‘block’. -
width: Specifies the default width for an inserted image. -
saveFormat: Indicates the format for storing images in the editor (Base64 or Blob).Select Base64 for numerous small images without a specific physical storage location.
-
height: Defines the default height for an inserted image. -
saveUrl: Specifies the URL for the service that handles image upload and storage on the server. -
path: Determines the storage location for images and their display path. -
maxFileSize: Sets the maximum file size allowed for image uploads.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tool = { items : ['Image']}
const insertimageSettings = {
allowedTypes: ['.jpeg', '.jpg', '.png'],
display: 'inline',
width: 'auto',
height: 'auto',
saveFormat: 'Blob',
saveUrl: null,
path: null
}
return (
<div>
<RichTextEditorComponent insertImageSettings={insertimageSettings} toolbarSettings={tool} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to { allowedTypes: [‘.jpeg’, ‘.jpg’, ‘.png’], display: ‘inline’, width: ‘auto’, height: ‘auto’, saveFormat: ‘Blob’, saveUrl: null, path: null, maxFileSize: 30000000}
insertVideoSettings VideoSettingsModel
Specifies video insert options in the Rich Text Editor, detailing properties such as:
-
allowedTypes: Allowed video file extensions as a comma-separated list (e.g., ‘.mp4’, ‘.mov’). -
layoutOption: Determines the display mode for videos (‘Inline’ or ‘Break’). -
width: Sets default width for inserted videos. -
saveFormat: Format for storing video files (Base64 or Blob).Select Base64 for numerous small video inserts without defined storage requirements.
-
height: Sets default height for inserted videos. -
saveUrl: URL of the service for handling video uploads and server storage. -
path: Identifies the path for storing and displaying videos. -
maxFileSize: Maximum file size allowed for video uploads.
Defaults to { allowedTypes: [‘.mp4’, ‘.mov’, ‘.wmv’, ‘.avi’], layoutOption: ‘Inline’, width: ‘auto’, height: ‘auto’, saveFormat: ‘Blob’, saveUrl: null, path: null, maxFileSize: 30000000}
keyConfig { : }
Customizes key actions in the RichTextEditor.
For example, German keyboard users can customize key actions using these shortcuts.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const keyConfig = {
'undo': 'ctrl+z',
'redo': 'ctrl+y',
'copy': 'ctrl+c'
}
return (
<div>
<RichTextEditorComponent keyConfig={keyConfig} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to null
locale string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ’’
maxLength number
Specifies the maximum number of characters allowed in the Rich Text Editor.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent maxLength={500} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to -1
numberFormatList NumberFormatListModel
Predefines advanced list types that populate the numberFormatList dropdown in the toolbar.
Defaults to {types: [{ text: ‘None’, value: ‘none’ },{ text: ‘Number’, value: ‘decimal’ },{ text: ‘Lower Greek’, value: ‘lowerGreek’ },{ text: ‘Lower Roman’, value: ‘lowerRoman’ },{ text: ‘Upper Alpha’, value: ‘upperAlpha’ },{ text: ‘Lower Alpha’, value: ‘lowerAlpha’ },{ text: ‘Upper Roman’, value: ‘upperRoman’ }]}
pasteCleanupSettings PasteCleanupSettingsModel
Configures paste options in the Rich Text Editor.
Properties:
- prompt: Boolean to enable or disable paste prompt.
- deniedAttrs: Attributes to restrict during paste.
- allowedStyleProps: Style properties allowed when pasting.
- deniedTags: Tags to restrict when pasting.
- keepFormat: Boolean to keep or remove format when pasting.
- plainText: Boolean to paste as plain text.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, PasteCleanup} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const pasteCleanupSettings = {
prompt: false,
deniedAttrs: null,
allowedStyleProps: ['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'], deniedTags: null,
keepFormat: true,
plainText: false
}
return (
<div>
<RichTextEditorComponent pasteCleanupSettings={pasteCleanupSettings} >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, PasteCleanup]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to {prompt: false,deniedAttrs: null,allowedStyleProps: [‘background’, ‘background-color’, ‘border’, ‘border-bottom’, ‘border-left’, ‘border-radius’,’border-right’, ‘border-style’, ‘border-top’, ‘border-width’, ‘clear’, ‘color’, ‘cursor’,’direction’, ‘display’, ‘float’, ‘font’, ‘font-family’, ‘font-size’, ‘font-weight’, ‘font-style’,’height’, ‘left’, ‘line-height’, ‘list-style-type’, ‘margin’, ‘margin-top’, ‘margin-left’,’margin-right’, ‘margin-bottom’, ‘max-height’, ‘max-width’, ‘min-height’, ‘min-width’,’overflow’, ‘overflow-x’, ‘overflow-y’, ‘padding’, ‘padding-bottom’, ‘padding-left’, ‘padding-right’,’padding-top’, ‘position’, ‘right’, ‘table-layout’, ‘text-align’, ‘text-decoration’, ‘text-transform’, ‘text-indent’,’top’, ‘vertical-align’, ‘visibility’, ‘white-space’, ‘width’, ‘flex-direction’],deniedTags: null,keepFormat: true,plainText: false}
placeholder string
Specifies the placeholder text for the content area of the RichTextEditor when it is empty.
Defaults to null
quickToolbarSettings QuickToolbarSettingsModel
Specifies the items to be rendered in the quick toolbar based on the target element.
Properties:
- enable: Boolean to show or hide the quick toolbar.
- actionOnScroll: Options for quick toolbar behavior on scroll:
- hide: The quick toolbar closes when the parent element is scrolled.
- none: The quick toolbar stays open even if the parent element is scrolled.
- link: Specifies items in the quick toolbar for links (‘Open’, ‘Edit’, ‘UnLink’).
- image: Specifies items in the quick toolbar for images (‘Replace’, ‘Align’, ‘Caption’, ‘Remove’, ‘InsertLink’, ‘Display’, ‘AltText’, ‘Dimension’).
- text: Specifies items in the quick toolbar for text (‘Cut’, ‘Copy’, ‘Paste’).
- audio: Specifies items for audio (‘AudioReplace’, ‘AudioRemove’, ‘AudioLayoutOption’).
- video: Specifies items for video (‘VideoReplace’, ‘VideoAlign’, ‘VideoRemove’, ‘VideoLayoutOption’, ‘VideoDimension’).
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, Audio, Video} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const quickToolbarSettings = {
enable: true,
actionOnScroll: 'none',
link: ['Open', 'Edit', 'UnLink'],
image: ['AltText', 'Caption', '|', 'Align', 'Display', '|', 'InsertLink', 'OpenImageLink', 'EditImageLink', 'RemoveImageLink', '|', 'Dimension', 'Replace', 'Remove'],
audio: ['AudioLayoutOption', 'AudioReplace', 'AudioRemove'],
video: ['VideoLayoutOption', 'VideoAlign', '|', 'VideoDimension', 'VideoReplace', 'VideoRemove'],
table: ['Tableheader', 'TableRemove', '|', 'TableRows', 'TableColumns', '|' , 'Styles', 'BackgroundColor', 'Alignments', 'TableCellVerticalAlign'],
text: ['Bold', 'Italic', 'FontColor', 'BackgroundColor']
}
return (
<div>
<RichTextEditorComponent quickToolbarSettings={quickToolbarSettings}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, Audio, Video]}
/>
</RichTextEditorComponent>
</div>
);
}
| Defaults to *{enable: true,actionOnScroll: ‘none’,link: [‘Open’, ‘Edit’, ‘UnLink’],table: [‘Tableheader’, ‘TableRemove’, ‘ | ’, ‘TableRows’, ‘TableColumns’, ‘ | ’ , ‘Styles’, ‘BackgroundColor’, ‘Alignments’, ‘TableCellVerticalAlign’],image: [‘AltText’, ‘Caption’, ‘ | ’, ‘Align’, ‘Display’, ‘ | ’, ‘InsertLink’, ‘OpenImageLink’, ‘EditImageLink’, ‘RemoveImageLink’, ‘ | ’, ‘Dimension’, ‘Replace’, ‘Remove’],audio: [‘AudioLayoutOption’, ‘AudioReplace’, ‘AudioRemove’],video: [‘VideoLayoutOption’, ‘VideoAlign’, ‘ | ’, ‘VideoDimension’, ‘VideoReplace’, ‘VideoRemove’],}* |
readonly boolean
Disables user interactions on the component when set to true.
Defaults to false
saveInterval number
Specifies the save interval in milliseconds for automatically saving the content.
The change event is triggered if the content changes from the last saved interval.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent saveInterval={500}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to 10000
shiftEnterKey ShiftEnterKey
Specifies tags to be inserted when the Shift + Enter keys are pressed.
-
BR- When the Shift + Enter key is pressed, abrtag will be inserted, which is the default behavior. -
P- When the Shift + Enter key is pressed, aptag will be inserted instead of the defaultbrtag. -
DIV- When the Shift + Enter key is pressed, adivtag will be inserted instead of the defaultbrtag.
Defaults to ‘BR’
showCharCount boolean
Enables or disables the display of the character counter.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar, Count} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent showCharCount={true}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar, Count]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to false
showTooltip boolean
Configures whether a tooltip should be displayed for the Rich Text Editor toolbar.
Defaults to true
slashMenuSettings SlashMenuSettingsModel
Configuration options for the slash menu feature in the Editor, used to display a mention popup.
Properties:
- enable: A boolean indicating whether the slash menu is enabled in the Editor.
- items: An array specifying the list of items to be displayed in the slash menu.
- popupWidth: Defines the width of the slash menu popup. Accepts values in pixels, numbers, or percentages. Numeric values are treated as pixels.
- popupHeight: Defines the height of the slash menu popup. Accepts values in pixels, numbers, or percentages. Numeric values are treated as pixels.
Defaults to {enable: false,items: [‘Paragraph’, ‘Heading 1’, ‘Heading 2’, ‘Heading 3’, ‘Heading 4’, ‘OrderedList’, ‘UnorderedList’,’CodeBlock’, ‘BlockQuote’],popupWidth: ‘300px’,popupHeight: ‘320px’}
tableSettings TableSettingsModel
Specifies the options for inserting tables in the Rich Text Editor, featuring properties like:
-
styles: Automatically appends a CSS class to tables for consistent styling. -
width: Defines default table width upon insertion. -
minWidth: Sets the minimum width for inserted tables. -
maxWidth: Indicates the maximum permissible width for tables. -
resize: Enables or disables table resizing functionality.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const tableSettings = {
width: '100%',
styles: [{ text: 'Dashed Borders', command: 'Table', subCommand: 'Dashed' },{ text: 'Alternate Rows', command: 'Table', subCommand: 'Alternate' }],
resize: true,
minWidth: 0,
maxWidth: null
}
return (
<div>
<RichTextEditorComponent tableSettings={tableSettings}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to { width: ‘100%’, styles: [ { text: ‘Dashed Borders’, class: ‘e-dashed-borders’, command: ‘Table’, subCommand: ‘Dashed’ }, { text: ‘Alternate Rows’, class: ‘e-alternate-rows’, command: ‘Table’, subCommand: ‘Alternate’ } ], resize: true, minWidth: 0, maxWidth: null}
toolbarSettings ToolbarSettingsModel
Specifies the configuration for the toolbar, including the alignment and rendering type.
By default, the toolbar floats at the top of the RichTextEditor.
When you scroll down, the toolbar will move with the page applying the specified offset.
Properties:
-
enable: A boolean value to show or hide the toolbar.
-
enableFloating: A boolean value to enable or disable the floating toolbar.
This keeps the toolbar fixed at the top of the RichTextEditor during scrolling. - type: Defines the toolbar type, with the following options:
- Expand: Overflowing toolbar items are hidden and can be accessed by clicking the expand arrow.
- MultiRow: Overflowing toolbar items wrap into the next row.
- Scrollable: Toolbar items are on a single line and can be scrolled horizontally if they overflow.
- Popup: Overflowing toolbar items wrap into a popup container.
- position: Defines the toolbar position, with the following options:
- Top: Positions the toolbar at the top of the RichTextEditor.
- Bottom: Positions the toolbar at the bottom of the RichTextEditor.
- items: An array specifying the items aligned horizontally in the toolbar.
’ ’ and ‘-‘ can be used to insert vertical and horizontal separator lines in the toolbar. - itemConfigs: Allows the modification of the default toolbar item configuration, such as the icon class.
By default, the toolbar is rendered with a scrollable option on mobile devices and does not support other toolbar types.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const toolbarSettings = {
enable: true,
position: ToolbarPosition.Top,
type: ToolbarType.Expand,
items: ['Bold', 'Italic', 'Underline', 'StrikeThrough',
'FontName', 'FontSize', 'FontColor', 'BackgroundColor',
'LowerCase', 'UpperCase','SuperScript', 'SubScript', '|',
'Formats', 'Alignments', 'OrderedList', 'UnorderedList',
'Outdent', 'Indent', '|',
'CreateTable', 'CreateLink', 'Image', '|', 'ClearFormat', 'Print',
'SourceCode', 'FullScreen', '|', 'Undo', 'Redo']
}
return (
<div>
<RichTextEditorComponent toolbarSettings={toolbarSettings}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
| Defaults to *{enable: true,enableFloating: true,position: ToolbarPosition.Top,type: ToolbarType.Expand,items: [‘Bold’, ‘Italic’, ‘Underline’, ‘ | ’, ‘Formats’, ‘Alignments’, ‘OrderedList’,’UnorderedList’, ‘ | ’, ‘CreateLink’, ‘Image’, ‘ | ’, ‘SourceCode’, ‘Undo’, ‘Redo’],itemConfigs: {}}* |
undoRedoSteps number
Specifies the number of undo history steps stored in the undo/redo manager.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent undoRedoSteps={30}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to 30
undoRedoTimer number
Specifies the interval time in milliseconds for storing actions in the undo/redo manager.
The minimum value is 300 milliseconds.
Defaults to 300
value string
Specifies the initial content to be displayed in the RichTextEditor’s content area. It should be a string.
The editor’s content can also be dynamically loaded from a database, AJAX, etc.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
const value ='rich text editor';
return (
<div>
<RichTextEditorComponent value={value}>
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
Defaults to null
valueTemplate string|Function
Accepts a template design and assigns it as the content of the Rich Text Editor.
The built-in template engine provides options to compile a template string into an executable function.
For example, it supports expression evaluation similar to ES6 template string literals.
import * as React from 'react';
import { RichTextEditorComponent, Toolbar, Inject, Image, Link, HtmlEditor, Table, QuickToolbar} from '@syncfusion/ej2-react-richtexteditor';
function App() {
return (
<div>
<RichTextEditorComponent >
<Inject services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]} />
<div>rich text editor</div>
</RichTextEditorComponent>
</div>
);
}
Defaults to null
width string|number
Specifies the width of the Rich Text Editor.
Defaults to ‘100%’
Methods
clearUndoRedo
Clears the undo and redo stacks and resets the undo and redo toolbar status to disable the buttons.
Returns void
closeDialog
Closes a specified dialog within the Rich Text Editor.
| Parameter | Type | Description |
|---|---|---|
| type | DialogType |
The type of dialog to close. |
Returns void
destroy
Destroys the component by detaching or removing all event handlers,
attributes, and CSS classes. It also clears the component’s element content.
Returns void
disableToolbarItem
Disables the specified toolbar items in the Rich Text Editor component.
| Parameter | Type | Description |
|---|---|---|
| items |
string | string[]
|
A single item or a collection of items to be disabled in the toolbar. |
| muteToolbarUpdate (optional) | boolean |
Determines whether to mute updates of the toolbar item status in the Rich Text Editor. |
Returns void
enableToolbarItem
Enables the specified toolbar items in the Rich Text Editor component.
| Parameter | Type | Description |
|---|---|---|
| items |
string | string[]
|
A single item or a collection of items to be enabled in the toolbar. |
| muteToolbarUpdate (optional) | boolean |
Determines whether to mute updates of the toolbar item status in the Rich Text Editor. |
Returns void
executeCommand
Executes a specified command within the rich text editor, optionally utilizing additional parameters to tailor execution.
| Parameter | Type | Description |
|---|---|---|
| commandName | CommandName |
The name of the command to be executed, such as ‘importWord’, ‘insertHTML’, and others. |
| value (optional) |
string | HTMLElement | ILinkCommandsArgs | IImageCommandsArgs | ITableCommandsArgs | FormatPainterSettingsModel | IAudioCommandsArgs | IVideoCommandsArgs | ICodeBlockCommandsArgs
|
- An optional parameter that supplies the necessary value relevant to the command. This could be a string, an HTMLElement, or specific argument types like ILinkCommandsArgs, etc., contingent on the command requirements. |
| option (optional) | ExecuteCommandOption |
Specifies additional options for executing the command, such as enabling features like undo functionality. |
Returns void
focusIn
Focuses the Rich Text Editor component.
Returns void
focusOut
Blurs the Rich Text Editor component, removing focus.
Returns void
getCharCount
Calculates the maximum number of characters currently in the Rich Text Editor.
Returns number
getContent
Retrieves the HTML or text content inside the RichTextEditor.
Returns Element
getHtml
Retrieves the HTML content from the Rich Text Editor.
Returns string
getRange
Get the selected range from the RichTextEditor’s content.
Returns Range
getSelectedHtml
Retrieves the HTML representation of the selected content as a string.
Returns string
getSelection
Retrieves the HTML markup from the currently selected content in RichTextEditor.
Returns string
getText
Retrieves the text content as a string.
Returns string
getXhtml
Retrieves XHTML validated HTML content from the Rich Text Editor
when the enableXhtml property is set to true.
Returns string
hideInlineToolbar
Hides the inline quick toolbar.
Returns void
Prints all the pages of the RichTextEditor by default.
Returns void
refreshUI
Refreshes the view of the editor.
Returns void
removeToolbarItem
Removes the specified toolbar items from the Rich Text Editor component.
| Parameter | Type | Description |
|---|---|---|
| items |
string | string[]
|
A single item or a collection of items to be removed from the toolbar. |
Returns void
sanitizeHtml
Sanitizes an HTML string to prevent cross-site scripting (XSS) attacks.
This method is applicable when the editor mode is specifically set to HTML.
| Parameter | Type | Description |
|---|---|---|
| value | string |
The HTML content to be sanitized for security purposes. |
Returns string
selectAll
Selects all content within the RichTextEditor.
Returns void
selectRange
Selects a specific content range or element.
| Parameter | Type | Description |
|---|---|---|
| range | Range |
Specify the range you want to select within the content. This method is used to select a particular sentence, word, or the entire document. |
Returns void
showDialog
Displays a specified dialog within the Rich Text Editor.
| Parameter | Type | Description |
|---|---|---|
| type | DialogType |
The type of dialog to display. |
Returns void
showEmojiPicker
Displays the emoji picker. If coordinates are provided, it positions the picker at those locations.
| Parameter | Type | Description |
|---|---|---|
| x (optional) | number |
The x-axis position for the emoji picker. |
| y (optional) | number |
The y-axis position for the emoji picker. |
Returns void
showFullScreen
Displays the Rich Text Editor component in full-screen mode.
Returns void
showInlineToolbar
Displays the inline quick toolbar.
Returns void
showSourceCode
Toggles the display of the HTML/Markdown source code within the editor.
Returns void
Events
actionBegin EmitType<ActionBeginEventArgs>
This event triggers before executing a command via toolbar items.
Cancel this event to prevent the command from executing by setting the cancel argument to true.
actionComplete EmitType<ActionCompleteEventArgs>
This event triggers after executing a command via toolbar items.
afterImageDelete EmitType<AfterImageDeleteEventArgs>
This event triggers when a selected image is removed from the Rich Text Editor content.
afterMediaDelete EmitType<AfterMediaDeleteEventArgs>
This event triggers when selected media is removed from the Rich Text Editor content.
afterPasteCleanup EmitType<object>
This event triggers after cleaning up copied content.
beforeDialogClose EmitType<BeforeCloseEventArgs>
This event triggers before a dialog is closed.
Cancel this event to prevent the dialog from closing by setting the cancel argument to true.
beforeDialogOpen EmitType<BeforeOpenEventArgs>
This event triggers before a dialog is opened.
Cancel this event to prevent the dialog from opening by setting the cancel argument to true.
beforeFileUpload EmitType<BeforeUploadEventArgs>
This event triggers before the media audio/video upload process starts.
beforeImageDrop EmitType<ImageDropEventArgs>
This event triggers before an image is dropped.
beforeImageUpload EmitType<BeforeUploadEventArgs>
This event triggers before the image upload process starts.
beforeMediaDrop EmitType<MediaDropEventArgs>
This event triggers before a media is dropped.
beforePasteCleanup EmitType<PasteCleanupArgs>
This event triggers before cleaning up copied content.
beforeQuickToolbarOpen EmitType<BeforeQuickToolbarOpenArgs>
This event triggers before the quick toolbar opens.
beforeSanitizeHtml EmitType<BeforeSanitizeHtmlArgs>
This event triggers before sanitizing the value. Applicable only when editorMode is HTML.
blur EmitType<Object>
This event triggers when the Rich Text Editor loses focus.
change EmitType<ChangeEventArgs>
This event triggers when the Rich Text Editor loses focus and changes have been made to the content.
created EmitType<Object>
This event triggers when the Rich Text Editor is rendered.
destroyed EmitType<Object>
This event triggers when the Rich Text Editor is destroyed.
dialogClose EmitType<Object>
This event triggers after a dialog has been closed.
dialogOpen EmitType<Object>
This event triggers when a dialog is opened.
fileRemoving EmitType<RemovingEventArgs>
This event triggers when selected media is removed from the insert audio/video dialog.
fileSelected EmitType<SelectedEventArgs>
This event triggers when media is selected or dragged into the insert media audio/video dialog.
fileUploadFailed EmitType<Object>
This event triggers when there is an error during media upload.
fileUploadSuccess EmitType<Object>
This event triggers when media has been successfully uploaded to the server side.
fileUploading EmitType<UploadingEventArgs>
This event triggers when media begins uploading in the insert media audio/video dialog.
focus EmitType<Object>
This event triggers when the Rich Text Editor gains focus.
imageRemoving EmitType<RemovingEventArgs>
This event triggers when a selected image is removed from the insert image dialog.
imageSelected EmitType<SelectedEventArgs>
This event triggers when an image is selected or dragged into the insert image dialog.
imageUploadFailed EmitType<ImageFailedEventArgs>
This event triggers when there is an error during image upload.
imageUploadSuccess EmitType<ImageSuccessEventArgs>
This event triggers when an image has been successfully uploaded to the server side.
imageUploading EmitType<UploadingEventArgs>
This event triggers when an image upload begins in the insert image dialog.
It provides access to the upload details through the event arguments.
quickToolbarClose EmitType<Object>
This event triggers after the quick toolbar has been closed.
quickToolbarOpen EmitType<Object>
This event triggers when the quick toolbar is opened.
resizeStart EmitType<ResizeArgs>
This event triggers when resizing starts for various elements including tables, images, videos, and the overall editor.
resizeStop EmitType<ResizeArgs>
This event triggers when resizing stops for various elements including tables, images, videos, and the overall editor.
resizing EmitType<ResizeArgs>
This event triggers when resizing elements such as tables, images, videos, and the overall Rich Text Editor.
selectionChanged EmitType<SelectionChangedEventArgs>
This event triggers when a non-empty text selection is made or updated in the Rich Text Editor.
Fires in both HTML and Markdown modes, providing detailed information about the current selection.
import * as React from 'react';
import {
RichTextEditorComponent,
Toolbar,
Inject,
Image,
Link,
HtmlEditor,
Table,
QuickToolbar,
} from '@syncfusion/ej2-react-richtexteditor';
function App() {
let editor;
function selectionChanged(args) {
console.log(args.selectedContent);
console.log(args.selection);
console.log(args.editorMode);
}
return (
<div>
<RichTextEditorComponent
ref={(richtexteditor) => {
editor = richtexteditor;
}}
selectionChanged={selectionChanged.bind(this)}
>
<Inject
services={[Link, Image, HtmlEditor, Toolbar, Table, QuickToolbar]}
/>
</RichTextEditorComponent>
</div>
);
}
slashMenuItemSelect EmitType<SlashMenuItemSelectArgs>
This event triggers when a slash menu item in the popup is selected by the user using mouse, tap, or keyboard navigation.
toolbarClick EmitType<Object>
This event triggers when a Rich Text Editor toolbar item is clicked.
toolbarStatusUpdate EmitType<Object>
This event is deprecated and no longer works. Use the updatedToolbarStatus event for undo/redo status.
updatedToolbarStatus EmitType<ToolbarStatusEventArgs>
This event triggers when the toolbar items status is updated.