Keyboard Support in React Rich Text Editor Component
12 Jun 202424 minutes to read
The editor has full keyboard accessibility that includes shortcuts to open and other actions with toolbar items, drop-down lists, and dialogs.
HTML formation shortcut key
You can use the following key shortcuts when the Rich Text Editor renders with HTML edit mode.
Actions | Keyboard shortcuts |
---|---|
Toolbar focus | Alt + f10 |
Insert link | Ctrl + k |
Insert image | Ctrl + Shift + i |
Insert audio | Ctrl + Shift + a |
Insert video | Ctrl + Alt + v |
Insert table | Ctrl + Shift + e |
Undo | Ctrl + z |
Redo | Ctrl + y |
Copy | Ctrl + c |
Cut | Ctrl + x |
Paste | Ctrl + v |
Bold | Ctrl + b |
Italic | Ctrl + i |
Underline | Ctrl + u |
Strikethrough | Ctrl + Shift + s |
Uppercase | Ctrl + Shift + u |
Lowercase | Ctrl + Shift + l |
Superscript | Ctrl + Shift + = |
Subscript | Ctrl + = |
Indents | Ctrl + ] |
Outdents | Ctrl + [ |
HTML source | Ctrl + Shift + h |
Fullscreen | Ctrl + Shift + f |
Exit Fullscreen | Esc |
Justify center | Ctrl + e |
Justify full | Ctrl + j |
Justify left | Ctrl + l |
Justify right | Ctrl + r |
Clear format | Ctrl + Shift + r |
Ordered list | Ctrl + Shift + o |
Unordered list | Ctrl + Alt + o |
Format Painter Copy | Alt + Shift + c |
Format Painter Paste | Alt + Shift + v |
Format Painter Escape | Esc |
[Class-component]
/**
* Rich Text Editor - HTMLEditor KeyConfig sample
*/
import { RichTextEditorComponent, Inject, Toolbar, HtmlEditor, Image, QuickToolbar, Link, FormatPainter} from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component {
rteObj;
toolbarSettings = {
items: ['Bold', 'Italic', 'Underline', 'StrikeThrough',
'FontName', 'FontSize', 'FontColor', 'BackgroundColor',
'LowerCase', 'UpperCase', '|',
'Formats', 'Alignments', 'OrderedList', 'UnorderedList',
'Outdent', 'Indent', '|',
'CreateLink', 'Image', '|', 'FormatPainter', 'ClearFormat', 'Print',
'SourceCode', 'FullScreen', '|', 'Undo', 'Redo']
}
docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
render() {
return (<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor; }} height={450} toolbarSettings={this.toolbarSettings}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, HtmlEditor, Image, QuickToolbar, Link, FormatPainter]} />
</RichTextEditorComponent>);
}
}
export default App;
/**
* Rich Text Editor - HTMLEditor KeyConfig sample
*/
import { RichTextEditorComponent, Inject, Toolbar, HtmlEditor, Image, QuickToolbar, Link, FormatPainter} from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component<{},{}> {
private rteObj: RichTextEditorComponent;
private toolbarSettings: object = {
items: ['Bold', 'Italic', 'Underline', 'StrikeThrough',
'FontName', 'FontSize', 'FontColor', 'BackgroundColor',
'LowerCase', 'UpperCase', '|',
'Formats', 'Alignments', 'OrderedList', 'UnorderedList',
'Outdent', 'Indent', '|',
'CreateLink', 'Image', '|', 'FormatPainter', 'ClearFormat', 'Print',
'SourceCode', 'FullScreen', '|', 'Undo', 'Redo']
}
public docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
public componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
public render() {
return (
<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor! }} height={450} toolbarSettings={this.toolbarSettings}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, HtmlEditor, Image, QuickToolbar, Link, FormatPainter]} />
</RichTextEditorComponent>
);
}
}
export default App;
[Functional-component]
/**
* Rich Text Editor - HTMLEditor KeyConfig sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj;
let 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']
};
function docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
return (<RichTextEditorComponent ref={(richtexteditor) => { rteObj = richtexteditor; }} height={450} toolbarSettings={toolbarSettings}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]}/>
</RichTextEditorComponent>);
}
export default App;
/**
* Rich Text Editor - HTMLEditor KeyConfig sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj: RichTextEditorComponent;
let toolbarSettings: object = {
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']
}
function docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
return (
<RichTextEditorComponent ref={(richtexteditor) => {rteObj = richtexteditor! }} height={450} toolbarSettings={toolbarSettings}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]} />
</RichTextEditorComponent>
);
}
export default App;
Markdown formation shortcut key
You can use the following key shortcuts when the Rich Text Editor renders with Markdown edit mode
Actions | Keyboard shortcuts |
---|---|
Toolbar focus | Alt + f10 |
Insert link | Ctrl + k |
Insert image | Ctrl + Shift + i |
Insert table | Ctrl + Shift + e |
Undo | Ctrl + z |
Redo | Ctrl + y |
Copy | Ctrl + c |
Cut | Ctrl + x |
Paste | Ctrl + v |
Bold | Ctrl + b |
Italic | Ctrl + i |
Strikethrough | Ctrl + Shift + s |
Uppercase | Ctrl + Shift + u |
Lowercase | Ctrl + Shift + l |
Superscript | Ctrl + Shift + = |
Subscript | Ctrl + = |
Fullscreen | Ctrl + Shift + f |
Ordered list | Ctrl + Shift + o |
Unordered list | Ctrl + Alt + o |
[Class-component]
/**
* Rich Text Editor - MarkdownEditor KeyConfig sample
*/
import { Image, Inject, Link, MarkdownEditor, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component {
rteObj;
toolbarSettings = {
items: ['Bold', 'Italic', 'StrikeThrough', '|',
'Formats', 'OrderedList', 'UnorderedList', '|',
'CreateLink', 'Image', '|', 'Undo', 'Redo']
};
valueTemplate() {
return (<div>
The sample is added to showcase **markdown editing**.
Type or edit the content and apply formatting to view markdown formatted content.
We can add our own custom formation syntax for the Markdown formation, [sample link](https://ej2.syncfusion.com/home/).
The third-party library <b>Marked</b> is used in this sample to convert markdown into HTML content.
</div>);
}
;
componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
render() {
return (<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor; }} height={450} toolbarSettings={this.toolbarSettings} valueTemplate={this.valueTemplate} editorMode={'Markdown'}>
<Inject services={[Toolbar, Image, Link, MarkdownEditor]}/>
</RichTextEditorComponent>);
}
}
export default App;
/**
* Rich Text Editor - MarkdownEditor KeyConfig sample
*/
import { Image, Inject, Link, MarkdownEditor, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component<{},{}> {
private rteObj: RichTextEditorComponent;
private toolbarSettings: object = {
items: ['Bold', 'Italic', 'StrikeThrough', '|',
'Formats', 'OrderedList', 'UnorderedList', '|',
'CreateLink', 'Image', '|','Undo', 'Redo']
}
public valueTemplate(): JSX.Element {
return(<div>
The sample is added to showcase **markdown editing**.
Type or edit the content and apply formatting to view markdown formatted content.
We can add our own custom formation syntax for the Markdown formation, [sample link](https://ej2.syncfusion.com/home/).
The third-party library <b>Marked</b> is used in this sample to convert markdown into HTML content.
</div>);
};
public componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
public docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
public render() {
return (
<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor! }} height={450} toolbarSettings={this.toolbarSettings} valueTemplate={this.valueTemplate} editorMode={'Markdown'}>
<Inject services={[Toolbar, Image, Link, MarkdownEditor]} />
</RichTextEditorComponent>
);
}
}
export default App;
[Functional-component]
/**
* Rich Text Editor - MarkdownEditor KeyConfig sample
*/
import { Image, Inject, Link, MarkdownEditor, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj;
let toolbarSettings = {
items: ['Bold', 'Italic', 'StrikeThrough', '|',
'Formats', 'OrderedList', 'UnorderedList', '|',
'CreateLink', 'Image', '|', 'Undo', 'Redo']
};
function valueTemplate() {
return (<div>
The sample is added to showcase **markdown editing**.
Type or edit the content and apply formatting to view markdown formatted content.
We can add our own custom formation syntax for the Markdown formation, [sample link](https://ej2.syncfusion.com/home/).
The third-party library <b>Marked</b> is used in this sample to convert markdown into HTML content.
</div>);
}
;
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
function docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
return (<RichTextEditorComponent ref={(richtexteditor) => { rteObj = richtexteditor; }} height={450} toolbarSettings={toolbarSettings} valueTemplate={valueTemplate} editorMode={'Markdown'}>
<Inject services={[Toolbar, Image, Link, MarkdownEditor]}/>
</RichTextEditorComponent>);
}
export default App;
/**
* Rich Text Editor - MarkdownEditor KeyConfig sample
*/
import { Image, Inject, Link, MarkdownEditor, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj: RichTextEditorComponent;
let toolbarSettings: object = {
items: ['Bold', 'Italic', 'StrikeThrough', '|',
'Formats', 'OrderedList', 'UnorderedList', '|',
'CreateLink', 'Image', '|','Undo', 'Redo']
}
function valueTemplate(): JSX.Element {
return(<div>
The sample is added to showcase **markdown editing**.
Type or edit the content and apply formatting to view markdown formatted content.
We can add our own custom formation syntax for the Markdown formation, [sample link](https://ej2.syncfusion.com/home/).
The third-party library <b>Marked</b> is used in this sample to convert markdown into HTML content.
</div>);
};
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
function docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
return (
<RichTextEditorComponent ref={(richtexteditor) => { rteObj = richtexteditor! }} height={450} toolbarSettings={toolbarSettings} valueTemplate={valueTemplate} editorMode={'Markdown'}>
<Inject services={[Toolbar, Image, Link, MarkdownEditor]} />
</RichTextEditorComponent>
);
}
export default App;
Custom key config
Customize the key config for the keyboard interaction of Rich Text Editor, using the keyConfig
property.
In the following sample, customize the cut, copy, paste toolbar action with ctrl+1, ctrl+2, ctrl+3, respectively.
[Class-component]
/**
* Rich Text Editor - Custom KeyConfig Sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component {
rteObj;
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']
};
keyConfig = {
'copy': 'ctrl+1',
'cut': 'ctrl+2',
'paste': 'ctrl+3'
};
docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
render() {
return (<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor; }} height={450} toolbarSettings={this.toolbarSettings} keyConfig={this.keyConfig}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]}/>
</RichTextEditorComponent>);
}
}
export default App;
/**
* Rich Text Editor - Custom KeyConfig Sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
class App extends React.Component<{},{}> {
private rteObj: RichTextEditorComponent;
private toolbarSettings: object = {
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']
}
private keyConfig: object = {
'copy': 'ctrl+1',
'cut': 'ctrl+2',
'paste': 'ctrl+3'
}
public docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
this.rteObj.focusIn();
}
}
public componentDidMount() {
document.addEventListener('keyup', this.docKeyUp.bind(this));
}
public render() {
return (
<RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor! }} height={450} toolbarSettings={this.toolbarSettings} keyConfig={this.keyConfig}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]} />
</RichTextEditorComponent>
);
}
}
export default App;
[Functional-component]
/**
* Rich Text Editor - Custom KeyConfig Sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj;
let 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']
};
let keyConfig = {
'copy': 'ctrl+1',
'cut': 'ctrl+2',
'paste': 'ctrl+3'
};
function docKeyUp(e) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
return (<RichTextEditorComponent ref={(richtexteditor) => { rteObj = richtexteditor; }} height={450} toolbarSettings={toolbarSettings} keyConfig={keyConfig}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]}/>
</RichTextEditorComponent>);
}
export default App;
/**
* Rich Text Editor - Custom KeyConfig Sample
*/
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from '@syncfusion/ej2-react-richtexteditor';
import * as React from 'react';
function App() {
let rteObj: RichTextEditorComponent;
let toolbarSettings: object = {
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']
}
let keyConfig: object = {
'copy': 'ctrl+1',
'cut': 'ctrl+2',
'paste': 'ctrl+3'
}
function docKeyUp(e: any) {
if (e.altKey && e.keyCode === 84) { /* t */
// press alt+t to focus the component.
rteObj.focusIn();
}
}
function componentDidMount() {
document.addEventListener('keyup', docKeyUp.bind(this));
}
return (
<RichTextEditorComponent ref={(richtexteditor) => { rteObj = richtexteditor! }} height={450} toolbarSettings={toolbarSettings} keyConfig={keyConfig}>
<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>
<ul>
<li>
<p>Provides <IFRAME> and <DIV> modes</p>
</li>
<li>
<p>Capable of handling markdown editing.</p>
</li>
<li>
<p>Contains a modular library to load the necessary functionality on demand.</p>
</li>
<li>
<p>Provides a fully customizable toolbar.</p>
</li>
<li>
<p>Provides HTML view to edit the source directly for developers.</p>
</li>
<li>
<p>Supports third-party library integration.</p>
</li>
<li>
<p>Allows preview of modified content before saving it.</p>
</li>
<li>
<p>Handles images, hyperlinks, video, hyperlinks, uploads, etc.</p>
</li>
<li>
<p>Contains undo/redo manager.</p>
</li>
<li>
<p>Creates bulleted and numbered lists.</p>
</li>
</ul>
<Inject services={[Toolbar, Image, Link, HtmlEditor, QuickToolbar]} />
</RichTextEditorComponent>
);
}
export default App;