I am posting the following code :
<img alt="" src="/sites/sitename.com/files/u4/avatar.jpg" style="width: 56px; height: 56px; float: left; border-width: 1px; border-style: solid; margin: 5px 10px;" />
But after filtered by wysiwyg_filter, i get :
<img alt="" src="/sites/sitename.com/files/u4/avatar.jpg" style="width:56px; height:56px; float:left; border-width:1px; border-style:solid" />
All the available styles under "Style Properties" are ticked and "HTML Elements and Attributes is configured to :
@[class|style|title],
a[href|target|title],
img[src|width|height|alt|title],
em, strong, strike, del, sub, sup, i, b, q, acronym, samp, kbd,
ul, ol, li, dl, dt, dd,
p[align<center?justify?left?right], br, hr,
div[align<center?justify?left?right], span,
table[width|cellpadding|cellspacing|border], tr[align|valign], td[align|valign|width], tbody, th[align|valign|width], thead, tfoot, colgroup, col, caption,
address, blockquote, pre, cite, code,
h1, h2, h3, h4, h5, h6
I have tried both the 1.4 and the 1.x-dev versions and get the same behavior.
Comments
Comment #1
gaellafond commentedI have the same problem.
The style attribute is not stripped as long as it contains only one value.
Not stripped:
But the filter strip them when it contains more than one value. This is a W3C valid case1 that is probably not taken in consideration by the WYSIWYG Filter Style parser.
Stripped:
The same bug apply to padding, and probably other styles such as border.
List of CSS1 elements possibly affected:
1. http://www.w3.org/TR/CSS1/#box-properties
See element 5.5.5 Margin
Value: [ <length> | <percentage> | auto ]{1,4}
Comment #2
gaellafond commentedComment #3
gaellafond commentedThe bug seems to be limited to margin and padding styles.
I made a patch but it doesn't allow 100% of valid cases. The filter will still strip margin and padding if it contains mixed values.
Example:
margin: auto 10px;
This sort of case is valid but it will be strip by the filter. Since it's not a common behaviour for a WYSIWYG editor, the patch is safe to be used.
NOTE: I made the patch for the last stable version (6.x-1.4). I didn't test is on the dev version. I will adapt it if it can not be apply.
Comment #4
kewlguy commentedsubscribing
Comment #5
BenK commentedSubscribing....
Comment #6
kewlguy commentedTHANK YOU!
Patch appears to work well for me, I was getting all kinds of missing string error back traces, as well as, formatting not working as expected on my site from the wysiwyg filter.
I applied the patch from #3 post, as well as, the patch from "Filter form validate and submit handlers overwritten" and all is real good!
My filter is working excellent now!
Drupal-6.16
A gazillion modules
Apache version 2.0.63
PHP version 5.2.12
MySQL version 5.0.90-community
Comment #7
gaellafond commentedI made the patch from copy of files and I forgot to correct the paths in the header. The patch will be more easy to apply like this.
Comment #8
markus_petrux commentedCould you please try this patch instead?
Comment #9
rggoode commentedsubscribing
Comment #10
gaellafond commentedExcellent!
Thanks markus_petrux for your patch. You moved only one parenthesis and it solved the problem. It event allow the case with mixed values such as
margin: auto 10px;. I tested it with many cases and it's seems to be perfect.I think this patch is ready to be ported.
Comment #11
markus_petrux commentedSweet. Committed path in #8 to CVS. Thanks for reporting the issue and the feedback provided.