Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
TinyMCE is tripping out "align" attributes from div tags. I know the solution involves adding div[align] to the extended valid elements. With the TinyMCE module, I used to do this by editing tinymce.module. How would I do this now that I'm using the Wysiwyg API?
Comments
Comment #1
sunDunno. But maybe http://drupal.org/project/wysiwyg_filter might assist you.
Comment #2
jonmower CreditAttribution: jonmower commentedWhat I've done for now is edit tinymce.inc and add the valid element that I want to one of the extended_valid_elements arrays of one of the buttons that I have selected.
I'll try the the wysiwyg_filter at some point, but my impression from poking around there that there is a desire to make it work nicely with Wysiwyg API but that hasn't been achieved yet. Therefore, my guess is that it wouldn't have the effect of allowing elements that tinymce currently strips out...but I don't know for sure.
Comment #3
sunWell, I don't think that Wysiwyg API will support any cryptic configuration options anytime soon.
Comment #4
tyates CreditAttribution: tyates commentedjonmower - Would you mind sharing with a newbie how to add to the extended_valid_elements array in tinymce.inc?
I need tinymce to keep empty div placeholders and have read that adding d[*] to the extended_valid_elements will do the trick. Wysiwyg_filter didn't do it. This ability is a deal killer for us.
Wysiwyg is a great module and I am not knocking the design decisions - I just need a work around that maybe other people don't need.
Comment #5
omerida CreditAttribution: omerida commentedIn your own module, define a plugin like this and tinymce won't strip out seemingly empty divs as long as they have an id, class, or style.
Comment #6
fuerst CreditAttribution: fuerst commentedAlternatively use hook_wysiwyg_editor_settings_alter() to change settings like this:
Replace YOURMODULE by the name of your custom module (see Module developer's guide).
Comment #7
niccottrell CreditAttribution: niccottrell commentedThanks fuerst! Works in D7 too :)
Comment #8
BenMirkhah CreditAttribution: BenMirkhah commentedThanks, just modified your code to allow inline SVG images inside TinyMCE WYSIWYG...