I am rendering a classic email template in a lightning-input-rich-text tag. The email template renders correctly and can be edited, but hitting backspace inside the rendered email template will delete the entire thing; editing/backspacing outside of the template behaves correctly. The lightning-input-rich-text tag is located on an LWC which is a modal. I have not seen this behavior on the component previously so I am wondering if Salesforce changed something.

Before backspace:

text area before backspace

After backspace:

text area after backspace


<lightning-layout class="slds-var-p-around_small">
    <lightning-layout-item class="slds-var-p-bottom_small" size="12">
        <lightning-input-rich-text value={emailBody} onchange={bodyChangeHandler}></lightning-input-rich-text>

JS change handler:

bodyChangeHandler(event) {
    this.emailBody = event.target.value; 

Apex retrieving the email render:

    public static LightningResponse initializeEmailPreview(Id templateId, Id targetId, Id whatId) {

        LightningResponse response = new LightningResponse();
        try {
            Messaging.SingleEmailMessage email = Messaging.renderStoredEmailTemplate(templateId, targetId, whatId);
            LightningEmail le = new LightningEmail(); 
            le.Subject = email.getSubject();
            le.Body = email.getHTMLBody();    
            response.Payload = le; 
            response.IsOK = true; 
        catch(Exception e) {
            response = formatErrorResponse(e); 
        return response;

1 Answer 1


Per Salesforce, editing HTML email templates in the lightning-input-rich-text tag is a know limitation and cannot be done.

  • Is this documented by Salesforce? How did you get this advice? Are you able to provide a link to their advice? I've got a similar issue and trying to work out how to deal with it.
    – Nick C
    Dec 22, 2022 at 2:27
  • We ended up opening up a case with Salesforce and they pointed us to the "Enabling and Disabling Formats in the Editor" section of the Input Rich Text LWC documentation which states "You can't create or edit a table or a header in the rich text editor". We developed somewhat of a workaround by replacing the <table> and </table> tags of the html email with divs dynamically in apex. It fixed the backspace issue, but it changed the email template layout too much to be a suitable workaround.
    – 29espoa
    Dec 27, 2022 at 15:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .