Skip to:
Content
Pages
Categories
Search
Top
Bottom

color attribute

  • I’ve written a WYSIWYG plugin for my BBPress install. It replaces the standard textarea with the TinyMCE WYSIWYG editor based on an option in the user profile.

    I’ve incorporated code from Michael D Adams’ ‘Allow Images’ plugin and extended it a little to include paragraph <p> tags and <span> tags.

    Everything is working fine, except for one issue that is driving me mad.

    When a span with color set in it’s style attribute set, the color: gets stripped out. For example <span style=”color: #ff0000;”> becomes <span style=””>.

    I can’t figure this out for the life of me! Other CSS attributes are fine, for example text-align:, background-color:, text-decoration: all work fine.

    I’ve tried the following two bits of code with no success:

    1. $tags = array(‘style’ => array());

    2. $tags = array(‘style’ => array(‘color’ => array()));

    Does anyone know if there is a way I can modify this behavior?

    This is my first attempt at a plugin, so apologies if I’m missing something obvious here!

    Thanks,

    Rick

Viewing 4 replies - 1 through 4 (of 4 total)

  • chrishajer
    Participant

    @chrishajer

    I think you might have better luck at the TinyMCE forum. It’s not a bbPress problem, (unless it’s a filter stripping out the tags) but something TinyMCE is doing with your span tags.

    http://tinymce.moxiecode.com/punbb/

    I suspect though that it’s got to do with the rules for span elements. The XHTML ruleset allows style but I’m not sure why it strips out the color. Or, are you filtering this through something in bbPress that would strip that out? (in WordPress, I think kses handles that.) Can you post spans with a color style as administrator? How about the ‘admin can post anything’ plugin?

    http://bbpress.org/plugins/topic/admin-can-post-anything/

    If the admin can post the <span style="color: #ff0000;">, WYSIWYG or not, then it’s likely a filter in bbPress that is stripping that code out.

    Chris – thanks for the response.

    With the admin can post anything plugin enabled it works fine (both through WYSIWYG and through the standard text area.

    So I guess that means it’s a filter in BBPress. I can’t figure out why it is happy with stuff like background-color: but not color:

    Cheers,

    R


    chrishajer
    Participant

    @chrishajer

    It does sound like it’s a filter in bbPress then, and TinyMCE is not at fault. Not sure where that happens in bbPresss, but I would think looking at the “Admin can post anything” plugin might offer some clues.

    Have a look in /bb-includes/formatting-functions.php

    If there is a filter, you should be able to find it in there.

    From there, have a look in template-functions.php and see if it is applying the filter to the post.

    EDIT: Forgot to mention, also look in the default-filters.php file.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.