While working with fckeditor in wysiwyg we where confused that custom css styles are getting ignored by fckeditor.

Comparing tinymce.inc and fckeditor.inc i see there's a missing settings wrapper for css_classes settings.
I'm currently checking how to bring this in.

Comments

miro_dietiker’s picture

Status: Active » Needs review
StatusFileSize
new841 bytes

Tried adding it using the CustomStyles dropdown.
In fckeditor an Element like span is needed to assign attributes and styles. How should this work in general?

I'm pretty sure the usage of t() needs work (omitted in tinymce.inc too). But we'd need something to translate the class titles into the right language.

What do you think of it?

twod’s picture

+++ fckeditor.inc	2009-12-31 14:30:36.000000000 +0100
@@ -122,6 +122,20 @@ function wysiwyg_fckeditor_settings($edi
+        $settings['CustomStyles'][t($classarr[0])] = array(

We should omit t() here. t() stores all the untranslated strings it finds in the database, so everything entered into the textarea will be permanently saved if it gets this far. There will also be no way to remove any translations if a class is removed from the textarea, nor will it be easy to figure out in which context these titles are used when encountered during translation. I don't know of a good solution to this problem unless the editor provides an easy way to translate the classnames prior to printing them out, which I don't think it does.

I'm on crack. Are you, too?

sun’s picture

Status: Needs review » Needs work
alan d.’s picture

Status: Needs work » Needs review
StatusFileSize
new945 bytes

@miro Just a word of warning about t(), is is not meant to take user data directly anyway. I guess these classes are escaped before being presented to the user, I hate security updates!

Tested on the following:

version = "6.x-2.x-dev"
datestamp = "1265329172"

The styles applied fine into a span element.

One very cool feature would be to support the target element attribute rather than always applying to a span. See the sites/all/libraries/fckeditor/fckstyles.xml

alan d.’s picture

StatusFileSize
new1.36 KB

And the very first time that I required the defined classes was on a p tag, so here is an updated one that allows for three arguments on the list. The third, if present and not empty, is used for the target element.

Do these tags require a check_plain?

hawleyal’s picture

This patch does add the custom CSS classes.

However, it only removes the first FCKeditor class (Red Title).

It leaves the rest of the FCKeditor classes intact.

I need to be able to control what classes my users can see and click.

Thanks.

-AH

nrackleff’s picture

Subscribing

japanitrat’s picture

subscribe