如何以编程方式将图像插入富含闪电的文本中?
我具有Base64格式的图像,我想将图像数据明确推入我的闪电输入富文本中。有什么办法吗?
我的代码看起来像这样:
<lightning-input-rich-text value={body} label="EmailBody" placeholder="Email Body" >
</lightning-input-rich-text>
在我的JS控制器中,我正在尝试执行此操作
this.body = this.filesUploaded[0]['VersionData']
// this.filesuploaded [0] ['versionData']代表base64格式数据
,而不是显示图像我的闪电输入富含text show base64 ex的字符串:('ivborw0kggoaaaa ....')
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 show base64 string for ex: ('iVBORw0KGgoAAAA....')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要确保您的文本控件内容添加了IMG HTML标签。因此,在您的JS文件中,您的身体变量必须设置为代表创建使用base64作为其源的IMG标签所需的HTML代码的字符串,例如:
You would need to make sure your are adding an IMG html tag to the contents of your rich text control. So, in your js file, your body variable must be set to a string that represents the html code needed to create an IMG tag that uses base64 as its source, e.g.: