79152467

Date: 2024-11-03 10:16:54
Score: 1
Natty:
Report link

IT goldman, Thanks for your reply and especially thanks for pointing out that my code worked. Your comment prompted me to further my testing. In fact I use DOMPurify library in addition to ckeditor 5 (https://ckeditor.com/ckeditor-5/). Your comment pushed me to test my DOMPurify code outside the ckeditor context and indeed I realized by doing this that my code worked as expected.

So I then investigated to understand what was happening by continuing testing ckeditor context.

In fact I had left the “font” plugin active in ckeditor configuration and because of that ckeditor was constantly adding this unwanted <span> tag after DOMPurify sanitization. What disturbed me.

<span style="background-color:transparent;color:#000000;"></span>

This post helped me identify and fix my problem https://github.com/ckeditor/ckeditor5/issues/6492

After removing the font plugin in ckeditor configuration everything works as expected.

In fact I don't even need to add DOMPurify anymore because ckeditor's Paste from Office/Paste from Google Docs feature cleans up google docs code perfectly for my needs.

Thanks again for your help and for taking the time to answer me because it allowed me to take a step back and fix my problem.

Thanks also for the idea of ​​the temporary conversion of strong to strong. I will keep this logic in my back pocket because it will certainly be useful to me in other situations.

I will modify the title of my post and add the label ckeditor because in fact the problem concerned more ckeditor than DOMPurify.

Thanks again

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (0.5): thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ripcurl