HTML Editor Striping Internal CSS Stylesheet

Topics: Administration, General
Sep 29, 2011 at 3:21 PM
Edited Sep 29, 2011 at 4:30 PM

I am trying to add new content but the Orchard CMS editor is deleting my internal css.  I would like to have the internal css on the page but the css is being stripped.  Is this normal behavior or am I doing something wrong?  Below is an example:

<style type="text/css">
.myclass { font-weight:bold; }
</style>

<div id="content">
<p class="myclass">stuff</p>
</div>

Update: found this FAQ from TinyMCE (current default Orchard CMS editor).  Could this be the issue, is TinyMCE configured to strip embedded CSS styles in Orchard?
TinyMCE strip away attributes or tags from my source?
You need to check out the valid_elements and extended_valid_elements option in the configuration. By default,
TinyMCE only allows certain tags and attributes. TinyMCE also tries to follow the XHTML specification as much as possible,
this can cause some unexpected source changes, there are however configuration options to battle this issue,
study the configuration options in details.
http://www.tinymce.com/wiki.php/TinyMCE_FAQ#TinyMCE_strip_away_attributes_or_tags_from_my_source.3F

Coordinator
Sep 29, 2011 at 5:07 PM

Amusingly your post broke the CodePlex forum. Anyway, yes, this is probably happening because of TinyMCE but it is right to strip this out: css must be in the head section of the page, not in the middle of it.

You should take a look at the classy feature of the Vandelay Industries module: it enables you to add custom classes to specific content items.

Sep 29, 2011 at 5:31 PM
Thanks for the response Bertrand. Yes, it did ... and what broke it was the FAQ I copied and pasted from the TinyMCE site :)

In the near future, we plan to replace TinyMCE with the CKeditor module, but needed a workaround until we're able to release the new CKEditor module to production. Using inline styling for now, until we figure out a better way to add CSS to content in production in a standard compliant way (i.e. inside the header in an external stylesheet).

On Thu, Sep 29, 2011 at 1:08 PM, BertrandLeRoy <notifications@codeplex.com> wrote:

From: BertrandLeRoy

Amusingly your post broke the CodePlex forum. Anyway, yes, this is probably happening because of TinyMCE but it is right to strip this out: css must be in the head section of the page, not in the middle of it.

You should take a look at the classy feature of the Vandelay Industries module: it enables you to add custom classes to specific content items.

Read the full discussion online.

To add a post to this discussion, reply to this email (orchard@discussions.codeplex.com)

To start a new discussion for this project, email orchard@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Sep 29, 2011 at 5:34 PM

You might want to try switching the flavor of the body part to plain HTML or to the new markdown feature that will be in 1.3.