Welcome! » Log In » Create A New Profile

Clean html comments. tinymce paste from word issue

Posted by jmut 
Clean html comments. tinymce paste from word issue
April 06, 2009 07:15AM

Hi folks, Htmlpurifier is great for me so far. I am using it to purify content coming from tinymce. There is one small issue though. Tinymce has this paste from word button that does some magic and remove weird content like this produced due to copy/paste from word (formatted text) directly into tinymce.

[html_coment_open] /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; .............85pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} [html_coment_close]

Issue is I give users to do edit so I cannot force them to use the paste from word button.

My question is how I can clear this up.. from what I see best shot is I clear all html comments with htmlpurifier. All ideas are more than welcome. Thanks.

Re: Clean html comments. tinymce paste from word issue
April 06, 2009 12:12PM

HTML comments are already removed by HTML Purifier. Could you post a sample input and your expected output?

Re: Clean html comments. tinymce paste from word issue
April 06, 2009 04:34PM

Yep, seems tinymce weirdness.. it passes those

<!--  /* Style Definitions */      ....... -->

as well as some non-escaped comments and of course htmlpurifier wipes out comments only. No prob with htmlpurifier as it seems. Thanks



$html = &#039;<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--> &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal   {mso-style-parent:"";   margin:0in;     margin-bottom:.0001pt;  mso-pagination:widow-orphan;       font-size:12.0pt;       font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in;     margin:1.0in 1.25in 1.0in 1.25in;       mso-header-margin:.5in;         mso-footer-margin:.5in;         mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; <!--[if gte mso 10]>
    <style>
 /* Style Definitions */
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";
        mso-ansi-language:#0400;
        mso-fareast-language:#0400;
        mso-bidi-language:#0400;}
</style>
<![endif]-->

Sorry, you do not have permission to post/reply in this forum.