views:

368

answers:

4

When pasting content from WORD a lot of the markup is being cleared up by using "Force cleanup on standard paste" using TinyMCE and WYSIWYG module. It seems however to leave in the following code:

<p>&nbsp;</p>

Is there any way so that I can filter this out?

A: 

As far as i know does tinymce have a clean code function. When this one is called it should remove the empty paragraphs.

But you should have to try this...

Bloeper
Using all the clean code options that I can see
Rupert
A: 

A quick and easy way is just to put something like this in your theme's template.php:

<?php
function THEMENAME_preprocess_node(&$vars, $hook) {
    $vars['content'] = str_replace('<p>&nbsp;</p>','', $vars['content']);
}

That just does a quick find and replace to replace the empty paragraph with nothing. It's sort of a hack, but it works.

Mike Crittenden
A: 

Are you sure that it's caused by TinyMCE and WYSIWYG? It can also be the combination of a setting in WYSIWYG (when "Remove linebreaks" is off) and your input filter settings ("Line break converter" is on).

marcvangend
A: 

I think it's come from: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=6005
You can filter at node saving time: http://api.drupal.org/api/function/hook_filter/6

Nikit