Copy Paste Weirdness in Rich Text Editor

Hi There,

The Blazor Rich Text Editor has weird Copy / Paste behaviour. 
(this can be reproduced here:https://www.syncfusion.com/blazor-components/blazor-wysiwyg-rich-text-editor )

Suppose we have a piece of HTML in the text editor, as follows:
<p>ABC</p>

In Preview Mode, select the text, copy it, and paste it. 
Here is the resultant HTML:

<p>ABC</p><p><span style="font-family: Roboto, &quot;Segoe UI&quot;, GeezaPro, &quot;DejaVu Serif&quot;, sans-serif, -apple-system, BlinkMacSystemFont;">ABC</span></p>

Shouldn't the result be this?
<p>ABC</p><p>ABC</p>

Because of this,  the first "ABC" is rendered differently to the second "ABC", when displayed in the app (the first occurrence uses the system style for <p> but the second occurrence forces a particular font family, as imposed by the Rich Text Editor.

Is there a way to prevent this behaviour?





3 Replies 1 reply marked as answer

IS Indrajith Srinivasan Syncfusion Team October 16, 2020 12:41 PM UTC

Hi Joseph, 
 
Greetings from Syncfusion support,

We have validated your reported query. In Preview Mode, we won’t remove the styles from the copied content. You can paste the formatted HTML in the Rich Text Editor by choosing the clean format option. If you preview the code using the code preview, you can now see the expected result. Check the below sample for demo and screenshots for reference.
 
 
 
Pasted HTML in preview mode: 
 
 
 
Switched to normal mode: 
 
 
 
Now copy the above content in the editor and remove it, now paste in editor choose the option Clean from the checkbox and click Ok: 
 
 
 
 
You can now preview the pasted content: 
 
 
 
Can you please check the above solution and let us know if it meets your requirements? 
 
Regards, 
Indrajith 


Marked as answer

JT Joseph Tan October 16, 2020 08:38 PM UTC

Hi There,

Yep - this line does the trick:

                <RichTextEditorPasteCleanupSettings Prompt="false" PlainText="false" KeepFormat="false"  />

Thanks



IS Indrajith Srinivasan Syncfusion Team October 19, 2020 09:08 AM UTC

Hi Joseph, 
 
Thanks for the update, 
 
We are glad that your reported issue is resolved. Please get back to us if you need any further assistance. 
 
Regards, 
Indrajith 


Loader.
Up arrow icon