Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Avoid pasting images in rich text editor (RTE)

SA-23988

Summary



Images to be pasted in RTE must be suppressed.

Error Messages



Not Applicable

Steps to Reproduce



1. Open a work object where RTE exists.
2. Paste HTML with images from Outlook or Word document.
3. Notice the images are pasted.

Root Cause



It is an expected behavior. In Pega 7.x implementation CKEditor is used, hence RTE is allowed to paste images. In PRPC 6.x, YUI editor is used, hence the image was suppressed while pasting into RTE.

Resolution



Perform the following local-change:
Include the code below in USERWORKFORM (or create an non-auto generated section and use this section where images must not be pasted in RTE.)

<script>
$(document).ready(function(){
setTimeout(function(){
if(window.CKEDITOR) {
for ( var ck_instance in window.CKEDITOR.instances ){
var cke=window.CKEDITOR.instances[ck_instance];
cke.on('paste', function(evt) {
if(evt.data.dataValue.indexOf("<img")>-1) {
var pData=evt.data.dataValue;
var count = (pData.match(/<img/g) || []).length;
while(count>0)
{
var rImgText=pData.split("<img")[1].split(">")[0];
rImgText="<img"+rImgText+">";
pData=pData.replace(rImgText,"");
count--;
}
evt.data.dataValue=pData;
}
});
}}
},50);
});
</script>

Published June 2, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us