Format at the beginning of the line with shorcuts

Hello syncfusion team.

I have an issue with formatting the text.

If you select the text you want to format and you add format with shortcuts (CMD+U, I, or B) it works perfectly.

I am using Chrome and Edge as the browser on my Mac.

CMD+I and CMD+B work for default.


But for using CM+U I implement the solution that you provide me in another thread.

The issue that I have is that before start writing a line you start adding format with shortcuts, some times is applied but sometimes.

I add a video about the issue for CMD Shortcuts.

Regards

Attachment: Key_Shortcuts_.mov_5141db1d.zip

1 Reply 1 reply marked as answer

RK Revanth Krishnan Syncfusion Team January 29, 2021 10:32 AM UTC

Hi Eliseo, 
 
 
Greetings from Syncfusion support. 
 
 
We have validated your query “Format at the beginning of the line with short cuts not working in the Rich Text Editor”. 
 
We are able to reproduce the issue from our end with the help of your shared video. This issue can be resolved by preventing the default actions for bold and italic and using the ‘executeCommand’ public method for bold and italic also along with the underline. We have modified the shared sample for your reference, 
 
Code Snippet: 
 
onCreate(rteObj) { 
  document.onkeydown = function(e) { 
    if (e.metaKey && e.keyCode === 85) { 
      rteObj.executeCommand("underline"); 
    } 
    if (e.metaKey && e.keyCode === 73) { 
      e.preventDefault(); 
      rteObj.executeCommand("italic"); 
    } 
    if (e.metaKey && e.keyCode === 66) { 
      e.preventDefault(); 
      rteObj.executeCommand("bold"); 
    } 
    if (e.shiftKey && e.keyCode == 13) { 
      e.preventDefault(); 
    } 
  }; 
} 
 
 
Please check the above code snippet and the sample and let us know if it resolves your issue. 
 
Regards, 
Revanth 


Marked as answer
Loader.
Up arrow icon