I know it's a bit frustrating that the is added inside your
but there is not something that can be done about to easily change it. It has behaved like this since the early versions of Umbraco - Not sure why but it's really an issue with the TinyMCE editor more than it's an Umbraco issue I think.
However in my experience this is a random behavior - Sometimes the class is added directly on the elements, sometimes a with the class is inserted. You simply need to make sure that your CSS styling takes this into account.
But I don't think it's a big issue - just something you need to accept even though it's not ideal. Ideally it should not be necessary to add classes to elements in a rich text editor. Consider if you can add them in your macroes or templates instead.
Previously, if you had selected all the text in a p tag, applying a style would add the class to the p tag itself.
Even after enabling the status bar to allow easy selection of an element, its still not possible to apply a class to an element directly so I think this is a new bug.
I've seen it been added directly to the paragraph and sometimes wrapped in a span across versions so I have never thought of adding a class using the rich text editor as being reliable. Don't think it's a new issue to be honest.
tinymce add class to containing p tag
I am trying to add a class to the contining p tag using the tinymce styles.
eg.
however, when I select the style from the format drop down list, an additional span is inserted
<p><span class="intro-text">test</span></p>
i have tried by just clicking in on the text, and also highlighting the text and both insert the additional span.
how can I add a class to the p tag directly?
Hi Adrian and welcome to our :)
I know it's a bit frustrating that the is added inside your
but there is not something that can be done about to easily change it. It has behaved like this since the early versions of Umbraco - Not sure why but it's really an issue with the TinyMCE editor more than it's an Umbraco issue I think.
However in my experience this is a random behavior - Sometimes the class is added directly on the elements, sometimes a with the class is inserted. You simply need to make sure that your CSS styling takes this into account.
But I don't think it's a big issue - just something you need to accept even though it's not ideal. Ideally it should not be necessary to add classes to elements in a rich text editor. Consider if you can add them in your macroes or templates instead.
I hope this helps.
/Jan
Thanks Jan for your response.
That's a bugger as it seems Tiny MCE does cater for it as seen in the example styles here http://www.tinymce.com/tryit/3_x/full.php
So it must be somewhere in the TinyMCE config and how Umbraco is implementing TinyMCE.
Like you said - it's not a big problem as long as you cater for styles on necessary tag variation.
Thanks,
Adrian
Hi Adrian & Jan,
I'm seeing this behaviour in U7 too.
Previously, if you had selected all the text in a p tag, applying a style would add the class to the p tag itself.
Even after enabling the status bar to allow easy selection of an element, its still not possible to apply a class to an element directly so I think this is a new bug.
Hi Antony
I've seen it been added directly to the paragraph and sometimes wrapped in a span across versions so I have never thought of adding a class using the rich text editor as being reliable. Don't think it's a new issue to be honest.
/Jan
Hi Jan/Adrian,
I've looked into this issue further and have a possible solution but there are some discussions to be had.
If you'd like to contribute to the dicsussion, pls head over to issue U4-1736 and let me know your thoughts.
TTFN
Ant
Has there been any movement on this? What a pain! It used to work fine in previous versions :(
I ended up using this https://github.com/umbraco/Umbraco-CMS/pull/630/files in umbraco.controllers.js
is working on a reply...