1

On a new drupal 7 installation, I'm trying to get line breaks to show up correctly when saved. I have wysiwyg and tinymce installed through using the panopoly distribution. When I try to do more space after a paragraph (by hitting enter twice), it will generate two empty paragraph tags, such as <p></p><p></p>. This however won't provide the needed space as they are empty. In an earlier (drupal 6) project, when I tested this behavior it would insert paragraphs with &nbsp; in them which correctly displayed the line breaks. For example: <p>&nbsp;</p><p>&nbsp;</p>

Is there any way to get this behavior back in Drupal 7?

I've played around with the wysiwyg settings, and text formats, but I can't find a combination of settings that will work.

3 Answers 3

1

It turns out this has something to do with the "WYSIWYG filter" under text formats (admin/config/content/formats). Disabling this gave my non-breaking space back. You would probably want to adjust the configuration rather than just turning it off.

0

The followin setup works in my Drupal 7 TinyMCE configuration:

  1. Turn off the WYSYWIG filter on the admin/config/content/formats page.
  2. Configure the 'Limit Allowed HTML tags' filter to allow for

    and
    tags.

Note: Filters are configured at admin/config/content/formats/MY_FILTER_NAME

0

Problem:

Drupal 6: Removed the CHARACTER REPLACEMENT "?" FOR NON-BREAKING-SPACE TAG in P tags from wysiwyg. The empty p tags were formerly placed to denote a change of line, however Drupal wysiwyg automatically adds a NON-BREAKING-SPACE TAG which thereby fail to display properly and thus be replaced with the CHARACTER REPLACEMENT "?"

Drupal 7: No nbsp tag but empty p tags

Working Solution:

$to_filter = array('bloc_1_delta', 'bloc_2_delta', 'bloc_3_delta', 'bloc_4_delta');
if (in_array($vars['block']->delta, $to_filter)) {
    $vars['block']->content = str_replace("<p></p>", "<br/>", mb_convert_encoding($vars['block']->content, 'HTML-ENTITIES', 'UTF-8'));
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.