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.
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
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
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
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!
is working on a reply...
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.