React HtmlEditor - Keyboard Support
Users can use the following keys to interact with the UI component:
PC | Mac | Action |
---|---|---|
Ctrl + C | ⌘ + C | Copy |
Ctrl + V | ⌘ + V | Paste |
Ctrl + Z | ⌘ + Z | Undo |
Ctrl + Y | ⌘ + Y | Redo |
Ctrl + A | ⌘ + A | Select All |
Ctrl + B | ⌘ + B | Bold |
Ctrl + I | ⌘ + I | Italic |
Enter | Insert a line break (a new paragraph) | |
Tab | Nest current list item (when in a list) | |
Increase indentation (when at the start of a paragraph) | ||
Move the cursor to the next table cell | ||
Shift + Tab | Move the cursor to the previous table cell | |
Decrease indentation (when at the start of a paragraph) | ||
↑ → ↓ ← | Navigate through the table | |
Enter | Move the cursor outside the table (when in the last row) | |
Esc | Close active dialog | |
Enter | Apply active dialog data |
You can implement a custom handler for a key using the registerKeyHandler(key, handler) method.
App.js
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import { HtmlEditor } from 'devextreme-react/html-editor';
- class App extends React.Component {
- constructor(props) {
- super(props);
- this.htmlEditorRef = React.createRef();
- }
- render() {
- return (
- <HtmlEditor ref={this.htmlEditorRef} />
- );
- }
- get htmlEditor() {
- return this.htmlEditorRef.current.instance;
- }
- componentDidMount() {
- this.htmlEditor.registerKeyHandler('backspace', function(e) {
- // The argument "e" contains information on the event
- });
- this.htmlEditor.registerKeyHandler('space', function(e) {
- // ...
- });
- }
- }
- export default App;
See Also
- Call Methods: Angular | Vue | React | jQuery | AngularJS | Knockout
- HtmlEditor Demos
- HtmlEditor API Reference
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.