RTE keyboard event

Hi, I'm having a problem when enter key pressed in the RTE;

How to get the keyboard pressed event in RTE?

Appreciating your help in advance. 

1 Reply

PM Pandiyaraj Muniyandi Syncfusion Team April 20, 2020 09:39 AM UTC

Hi Jaehyun, 
 
Greetings from Syncfusion support. 
 
We have validated your query, currently we doesn’t have keyboard event in our RichTextEditor component. We can achieve it from application end by binding keyboard event (keyup) into edit element of the editor. 
 
Follow below steps to configure keyboard event 
 
  1. Bind created event in RichTextEditor component
 
 
  <RichTextEditorComponent ref={(richtexteditor) => { this.rteObj = richtexteditor; }} created={this.onCreate.bind(this)}> 
  </RichTextEditorComponent> 
 
 
  1. Define onCreate handler function and bind keyboard event to edit element of the editor
 
 
// created event handler 
onCreate() { 
    var editarea = document.querySelector('.e-richtexteditor .e-rte-content .e-content'); 
    editarea.addEventListener('keyup'this.docKeyUp); //Bind keyup event 
} 
 
// KeyUp event handler 
docKeyUp(e) { 
    if (e.keyCode === 13) { 
        alert("Enter keypressed"); 
    } 
} 
 
 
We have prepared sample for your reference, check the below link 
 
Regards, 
Pandiyaraj 


Loader.
Up arrow icon