Copied to clipboard

Flag this post as spam?

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


  • Evan 40 posts 59 karma points
    Nov 19, 2010 @ 01:33
    Evan
    0

    Remove formatting (inline styles) when pasting HTML into Tiny MCE

    Hi,

    We're moving an old site to Umbraco, and part of the process is to copy and paste content into the form fields.

    The problem is that when I copy the HTML and paste it into my RichTextField, all teh formatting and inline styles are kept. This is a pain as the styles override my current CSS.

    I'm sure this is by design, but I was wondering if anyone has had the same problem, and has a clever work around?

    At the moment I just have to paste it into notepad or something.

    Thanks in advance!

    -Evan

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Nov 19, 2010 @ 14:35
    Tom Fulton
    0

    Hi Evan,

    In /config/tinyMceConfig.config you can specify what attributes are allowed for each tag.  So if you know what tag(s) have inline styles you can prevent the style attribute from being used on it.

    Check /config/tinyMceConfig.config in the <validElements> area.

    For example, to prevent the style attribute from being used on <a tags, change

    .........  +a[id|style|rel|  .........

    to

    .........+a[id|rel|  .........

    Remember to touch the web.config file to apply the changes

    More info:  http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements

  • Evan 40 posts 59 karma points
    Nov 23, 2010 @ 12:22
    Evan
    0

    Tom, this worked excellently! Thank you so much!

    It also works great for posting from Word etc (as I'm sure you know).

    Thanks again!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies