Problem/Motivation
I have come across a problem when pasting from Word Office 365 online.
The filtering is working correctly for the most part but it seems to be stripping the <strong> and <em>
tags when being pasted into a Full HTML CKE5 body field.
It seems like this search expressions: (<[^>]*) (style="[^"]*") is the one that is stripping out the <strong> and <em>
tags, as when testing the expressions one by one, when this one was disabled, the strong and em tags reappeared.
Steps to reproduce
1. Open or Create a Word doc in Word Microsoft 365.
2. Create text that has some bold and italic text
3. Copy this text from word
4. Paste into a Full HTML body field
5. Check source
Have you disabled any default filters, or added new custom filters?
If you are using a custom set of filters, provide the details here.
Use code tags for search and replacement strings like the following,
or include your text format configuration YAML in code tags.
Yes, I have some custom search expressions. Here is the list of customs:
Search expression: <div id="WACViewPanel_ClipboardElement" contenteditable="false" spellcheck="false" tabindex="0">
Replacement: <div>
Search expression: <p\s+(?=.*\brole="[^"]*")(?=.*\baria-level="4")(?=.*\bparaid="[^"]*")(?=.*\bparaeid="\{[^}]*\}\{[^}]*\}").*?>
Replacement: <h4>
Search expression: <p\s+paraid="[^"]*".*?>
Replacement: <p>
For support requests and bug reports about pasting content, please provide brief markup samples.
Otherwise, delete this "Markup samples" section from here until "End of Markup samples section".
Feel free to provide multiple samples in each section if that helps illustrate your issue.
Markup samples
Markup result (pasting without filtering)
<p class="Paragraph SCXW106221821 BCX2" style="background-color:transparent;color:windowtext;font-style:normal;font-weight:normal;padding-left:0px;padding-right:0px;text-align:left;text-indent:0px;vertical-align:baseline;" paraid="345522415" paraeid="{c040a987-1294-4219-82fd-ca3c005fdccae}{10}">
<span class="TextRun SCXW106221821 BCX2 NormalTextRun" style="font-family:Calibri, "Calibri_EmbeddedFont", "Calibri_MSFontService", sans-serif;font-size:11pt;line-height:16.1875px;" data-contrast="auto" xml:lang="EN-US" lang="EN-US"><strong>This should be bold copy —</strong> </span><em><span class="TextRun SCXW106221821 BCX2 NormalTextRun" style="font-family:Calibri, "Calibri_EmbeddedFont", "Calibri_MSFontService", sans-serif;font-size:11pt;line-height:16.1875px;" data-contrast="auto" xml:lang="EN-US" lang="EN-US">This should be Italics</span></em>
</p>
Markup result (pasting with filtering)
<div>
<div>
<p>
This should be bold copy — This should be Italics
</p>
</div>
</div>
Expected markup result
<div>
<div>
<p>
<strong> This should be bold copy</strong> — <em>This should be Italics </em>
</p>
</div>
</div>