Is it possible to make tinymce respect the drupal filter, e.g.

  • automatic line/page breaks (do not insert <p> and <br /> tags, break lines as drupal does) if these tags are filtered out
  • do not insert/offer buttons for illegal tags

Thus there won't be confusions about what tinymce shows as "wysiwyg" and what drupal shows in it's output. Also users can switch between plain text and rich text when editing content.

Comments

pepe roni’s picture

Addendum:

Now playing with the tinymce profiles and drupal filters I configured the following:

  • I cloned the input format "filtered HTML" to "Rich Text HTML" but left out the line and paragraph break filter, but added <p> and &ltbr> instead. "filtered HTML" is still the default input format.
  • Then I set the tinymce profile in the section "cleanup and output" to:
    • verify html: true.
      If you set it to false <strong> will be replaced with <b>(which will be filtered out) when switching(!) between rich text and plain text editing.
    • preformatted: false.
      If you set it to true, <pre> tags are inserted and when switching between rich text and plain text editing <br /> are inserted again and again the more you switch.
    • convert <font> tags to styles: false.
      I don't know what happens, if it is set to true.
    • Remove linebreaks: false.
      If you set it to true, double line breaks (i.e. the drupal filter paragraph break) are removed when switching from plain text editing to rich text editing and vice versa.
    • Apply source formatting: false.
      If you set it to true, line breaks are inserted after each paragraph and line break tag. When the drupal filter has removed all these tags, empty lines are left out (which will result in paragraph breaks, even in those places where line breaks are desired).

If there are still formatting problems, the user can switch the input format from "filtered HTML" to "Rich Text HTML".

What I achieved with this configuration:

  • Plain Text editing is possible
  • Rich text editing is possible
  • switching (without editing) between the two modes is possible
  • switching from rich text to plain text and then editing the content is possible

What I did not achieve with this configuration:

  • Switching from plain text to rich text and then editing is not so easy: the user has to insert all the line breaks and paragraph breaks manually to see them in the editor

Update: As most users do not have the right to switch the input format, I installed Smart Line Break Converter, made "Rich Text HTML" the default input format and most problems were gone.

But there is still the problem that TinyMCE does not respect the drupal filter (but in case of line breaks it is a minor issue now).

mupsi’s picture

Issue summary: View changes
Status: Active » Closed (outdated)