User login

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:

We highly recommend downloading the WYSIWYG line breaks (drupal.org/project/wysiwyg_linebreaks) in addition to the WYSIWYG module. This add-on module helps fix some of the HTML oddness that WYSIWYG editors can cause.

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

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.