3

We have some requirements pushing us towards a better HTML editor than the default rich text field editor.

The first one I found Googling is from Froala but a few years ago it didn't work inside an LWC - SF Lightning Component issue: not able to replace a textarea with third party text editor.

Is there a decent WYSIWG HTML editor that will run inside an LWC?

This is for managed package, so even when not beta the Light DOM (Beta) sounds like it won't be usable:

Distributing components rendered in light DOM isn’t supported. Component references in a managed package use the c namespace and would result in a namespace conflict.

2
  • is the standard lightning-input-rich-text not satisfactory? Jan 5, 2023 at 13:56
  • 1
    Hi @BryanAnderson, I'll take a look at that.
    – Keith C
    Jan 5, 2023 at 14:43

1 Answer 1

2

I was able to get Froala working in an LWC, so it's not LWC's fault. Most of the time, you'll find that errors of the "parameter 1 is not a X" errors are related to Locker Service (LS) or Lightning Web Security (LWS). If you're having trouble with these kinds of errors, try Enabling Lightning Web Security. Most/all editors should work in LWC proper, with minimal modification, it's more a matter of finding ones that are Locker Service or Lightning Web Security compliant. As far as I'm aware, there are few to none LS-compatible editors because LS is more restrictive of what you can do with the DOM and the elements within. LWS allows much more capability, and should allow many of the most popular FOSS editors (TinyMCE, CKEditor, etc) to work inside Salesforce.

Demo.

1
  • Thanks, that's encouraging. I'll read up some more about Lightning Web Security.
    – Keith C
    Jan 5, 2023 at 14:45

You must log in to answer this question.

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