1

I am exploring the possibilities of creating a custom rich text component that will be used in a community. The documentation explains how to create the rich text input and then format the output. https://developer.salesforce.com/docs/component-library/bundle/lightning-input-rich-text/documentation https://developer.salesforce.com/docs/component-library/bundle/lightning-formatted-rich-text/documentation

How could it be implemented for use in Communities such that in the builder a user can edit the rich text input, but on the published site only the output is displayed?

1 Answer 1

0

If you are familier with aura framework, you can expose particular properties as design attributes which can be set in lightning App builder or experience builder. We can use similar approach in LWC.

So, instead of using lightning-input-rich-text, you can use lightning-formatted-rich-text (https://developer.salesforce.com/docs/component-library/bundle/lightning:formattedRichText/example). Now, you can bind the value of the component to a public property in your js class, and expose that public property as a target config property in your components meta file.

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_configuration_tags

4
  • 1
    Yes I understand this. But rich text is not an accepted type for property config. The accepted types are String, Boolean, Integer, Color, Date, Datetime and Apex-defined data type.
    – Jordan
    Commented Mar 18, 2021 at 12:44
  • Okay, then simply use the 'Rich Content Editor' component which is available in the builder, no need to create a custom component. Commented Mar 19, 2021 at 12:13
  • This standard component does not meet the requirements thats why I am looking to build custom.
    – Jordan
    Commented Mar 19, 2021 at 13:12
  • 1
    @Jordan have you found a work around for this? I'm in need to implement the same too :(
    – MayurCM
    Commented Apr 21, 2021 at 6:29

You must log in to answer this question.

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