Skip to Content
0
Sep 09, 2019 at 06:05 AM

Unable to add image in Rich Text editor via code

172 Views Last edit Sep 09, 2019 at 12:08 PM 2 rev

Hello experts,


I am unable to add image in Rich Text editor via code, following is what my code looks like, it'd be very helpful if someone can point out what I might be doing wrong or what's the right way to do it.

sImageText = '<p><img src="data:image/jpeg;base.....';
sImageText += '.more parts of base64 url';
sImageText += '.more parts of base64 url';
sImageText = sImageText.replace(/"/g, "'");
sImageText = sImageText.replace(/"/g, "'");
oRichTextEditor.setValue(sImageText);
that.getView().byId(sContainerId).addContent(oRichTextEditor);

all I get is an empty <img> tag instead of entire base64 url in it