0

I have an image in base64 format and I want to push the image data explicitly into my lightning-input-rich-text. Is there any way?

My code looks like this:

 <lightning-input-rich-text 
     value={body} 
     label="EmailBody" 
     placeholder="Email Body" 
 >
 </lightning-input-rich-text>

and in my JS Controller I am trying to do this

this.body = this.filesUploaded[0]['VersionData']
// this.filesUploaded[0]['VersionData'] represent the base64 format data

Instead of showing the image my lightning-input-rich-text shows base64 in string for ex: ('iVBORw0KGgoAAAA....')

1 Answer 1

0

After reading some docs the answer comes out to be

this.body = '<img src="data:image/png;base64,' + this.filesUploaded[0]['VersionData'] + '" />';

You must log in to answer this question.

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