How to remove Bold from Rich Text Editor

Hi,
Is there an option to have the Rich Text Editor disable Bold functionality and disable Ctrl + B in Windows and Command-Shift-B in Mac OS.

Thanks!

1 Reply 1 reply marked as answer

IS Indrajith Srinivasan Syncfusion Team July 17, 2020 12:30 PM UTC

Hi Harutyun, 
 
Greetings from Syncfusion support, 
 
We have validated your reported query. Yes, you can prevent the Bold functionality in the Rich Text Editor. By preventing the default keydown action binding for the inputElement and resetting the originalEvent action. We have also prepared a sample that tries to meet your requirements. 
 
 
<ejs-richtexteditor id="customKey" actionBegin="onbegin" created="created"></ejs-richtexteditor> 
 
<script> 
    var defaultRTE; 
    function created() { 
        defaultRTE = this; 
        defaultRTE.inputElement.addEventListener("keydown", (args) => { 
            if (args.ctrlKey && args.keyCode === 66) { 
                args.preventDefault(); 
            } 
        }) 
    } 
    function onbegin(args) { 
        if (args.requestType === "bold") { 
            args.originalEvent.action = "non-bold"; 
        } 
    }     
</script> 
 
 
 
Please let us know if the solution helps, 
 
Regards, 
Indrajith 


Marked as answer
Loader.
Up arrow icon