Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris May 3 posts 23 karma points
    Aug 27, 2010 @ 07:20
    Chris May
    0

    Content Editor HTML Keeps Changing

    I'm trying to put some HTML that I've validated with TidyHTML as xhtml into the "View Source" area of a content editor.

    I am pasting in a page worth of content, but I'll just show the first few tags... Here is what I paste in:

      <div class="main_body_R">
        <div style="MARGIN: 0px 0px 0px -9px">
          <div class="main_body_R_top">
            <div class="main_body_R_top_new">
              About Us
            </div>
            ...

    So then I hit "Update".

    If I press the HTML button again, my HTML now looks like:

    <div sizset="0" sizcache="5" class="main_body_R">
    <div sizset="0" sizcache="5" style="MARGIN: 0px 0px 0px -9px">
    <div class="main_body_R_top">
    <div class="main_body_R_top_new">About Us</div>

    Ok so it added some crap attributes, but for the most part things are still looking good.

    If I hit Cancel and then "Save and Publish" the actual page HTML is now:

    <div sizset="0" sizcache="0" class="main_body_R">
    <div sizset="0" sizcache="0" style="MARGIN: 0px 0px 0px -9px">
    <div class="main_body_R_top">About Us</div>

    As you can see, it just totally screwed up the HTML.  Moving the "About Us" up to the "main_body_R_top" div and deleting the "main_body_R_top_new" div.

     

    Can anyone give any suggestions?  As I said earlier, I thought maybe it was a validation thing so I ran all my html through tidyhtml before I put it into the content area.

     

  • Sascha Wolter 615 posts 1101 karma points
    Aug 27, 2010 @ 13:31
    Sascha Wolter
    0

    Hi Chris,

    I'm afraid that I'm no WYSIWYG/TinyMCE guru, yet from my understanding of how it works then what you are trying to do is crying out for trouble (aka will give you loads of headache before you maybe might get this to work). I just tried for fun to paste the above into an empty TinyMCE window and it stripped out all the other divs and added additional attributes similar to your ones. TinyMCE tries to be 'intelligent' when you save the content, there is AFAIK no box that you can tick to say 'just take everything I type in here literally now'.

    That doesn't help you of course. One way of doing the above - if you have to insert the content via the WYWIWYG box which is in general not ideal anyway - might be to put the html in a macro which you can then add to the TinyMCE editor? If you need to customize the content on a couple of places you can easily add some custom fields to the macro.

    The other option would be to try and figure out how to tell TinyMCE that it should take the stuff without post-processing it. I know there are a lot of options out there, have a look at the TinyMCE site. Config files are stored in /config/TinyMCEConfig.config and what you most likely need is modify the TinyMCE js config in /umbraco_client/tinymce3. This is however quite a ride and might potentially lead to white hair.... Obviously if you change how TinyMCE works it will be applied to all of the instances created by the same data type, so you can't turn it on or off as you go along.

    Hope that helps somehow,
    Sascha

Please Sign in or register to post replies

Write your reply to:

Draft