According to this documentation, it should be possible to use filtered HTML and at the same time allow users to type colored text. The documentation says:
Due to security reasons, enabling Full HTML is only an option for trusted users.(...) Filtered HTML not only strips disallowed tags, but also strips inline style definitions. Basically, it means that you are unable to apply different font color, size, family etc. using FCKeditor 2.5 out of the box. Don't worry, you still have at least three ways of dealing with it:(...) 3. Instead of using 4 buttons for formatting text: 'FontFormat','FontName','FontSize','TextColor' use only one 'Style' button with predefined styles in fckstyles.xml.

I can't achieve this . CKEditor always strips any color information when using filtered HTML format, even when using the "Styles" button as suggested above . Here is what I've done:

1. In Content authoring->Text formats section, checked the "Limit allowed HTML tags" box and listed allowed tags as in documentation mentioned above. So there are plenty.

2. In Content authoring->CKEditor section, security tab, checked the "Limit allowed HTML tags", "Convert URLs into links", "Convert line breaks into HTML (i.e. <br> and <p>)" boxes. Also in CSS section, picked "Use theme ckeditor.styles.js" from dropdown list.

3. Copied the ckeditor.styles.js file from its default location to sites/all/themes/mytheme folder. In this file, there is a style defined for yellow marker.

4. Edited the node and chose "Marker: Yellow" style for a piece of text. In the plain text editor, the text looked like this: <span style="background-color:yellow;">Vivamus mattis</span> And in wysiwyg editor, it looked yellow.

5. Saved the node and the yellow color was stripped.

What was incorrect in this procedure, or maybe I misunderstood the documentation and in fact there is no possibility to allow color text at all using filtered HTML format ?

Comments

raincloud’s picture

Title: Use custom styles with filtered HTML » CKEditor: Use custom styles with filtered HTML
raincloud’s picture

anyone?

dczepierga’s picture

Status: Active » Closed (works as designed)

Hi,
If u want to use it, u must disable filter "Limit allowed HTML tags" in CKEditor profile and Text formats configuration.

In Text formats configuration on Limit allowed HTML tags filter in the field where u define allowed tags, u have following hint:

A list of HTML tags that can be used. JavaScript event attributes, JavaScript URLs, and CSS are always stripped.

We can't do anything with it, because it's related with Drupal engine - u could try to use additional module to filter your text instead e.g. HTML Purifier or any other...

If u have more questions pls reopen this issue.

Greetings