TinyMCE in WYSIWYG API destroys HTML it does not like no matter what the settings
A client wanted to center an embedded video and was disabling rich text in order to add tags around it to center it. Save it and it works, but edit the node and the WYSIWYG would strip the new tags and break the formatting on save. Granted, these are deprecated tags that were being used but it is not the WYSIWYG's place to be enforcing that.
Unchecking Paste from Word button and unchecking all of these and TinyMCE still deletes center or div align="center" tags.
Verify HTML
If enabled, potentially malicious code like tags will be removed from HTML contents.
Convert tags to styles
If enabled, HTML tags declaring the font size, font family, font color and font background color will be replaced by inline CSS styles.
Remove linebreaks
If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters.
Apply source formatting
If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.
Force cleanup on standard paste
If enabled, the default paste function (CTRL-V or SHIFT-INS) behaves like the "paste from word" plugin function.
In this case the work-around was simple enough, use the TinyMCE WYSIWYG editor's preferred <p style="text-align: center;">
.
But it really shouldn't be messing with HTML, even deprecated HTML, if it is instructed not to.
Comments
Slightly related, and humorous
Some time after DGD7 was published, i was harrassing everyone in IRC about a solution to a problem that will let a human edit HTML generated by WYSIWYG, and have TinyMCE not destroy the formatting a human had previously put in, and eventually Quicksketch -- who at first didn't think the problem was solveable -- found http://drupal.org/project/wysiwyg_linebreaks
From page 97 of the Definitive Guide to Drupal 7, a sentence that i happened to write:
Maybe i should have read what i'd written.
Essentially WYSIWYG Linebreaks lets you have your rich text editor and keep your Drupal-style HTML, which is the basic HTML markup minus when needed minus the paragraph tags that are redundant with sensible whitespace.
Post new comment