This report has been originally posted on our dev site - ticket http://dev.fckeditor.net/ticket/2074 by eigentor. We've checked and it isn't a problem in the FCKeditor so we're posting this report here. If this bug has been already noted please close this ticket.

Ticket by eigentor:
If there are no <p></p> tags present in a text box, FCKeditor will always add it in the end, no way around it. Similar as in this ticket: http://dev.fckeditor.net/ticket/382 Switching between code view and normal view will do the same.

It is present in Firefox but also IE7. It happens when integrating FCKeditor into Drupal, so I don't know if it is anything to do with the integration.

e.g. when I've got only an <ul><li></li></ul> inside a text box. I tried wrapping the entire ul in a <p>, but this also does not work, it ends up having a <p>&nbsp;</p> in front and behind the <ul>.

Changing the enter mode to <br> helped, but this is no solution, since the client should be able to press enter and get <p> tags.

It appears to me that the editor always needs to create <p></p> in every text box. If it does not succeed, it puts it in the end. And it appears to be unable to wrap it around inline elements.

Comments

kayaker’s picture

This "glitch" makes it nearly impossible to get rid of the "Read more" because the extra <p>&nbsp;</p> is added after the <!--break--> during the SAVE. (I checked the nr table.)

The problem continues even after disabling the FCKEditor (exclude node path) for a specific node and using what is presumably a Drupal plain textbox. Something (Drupal or FCKEditor module) appears to be appending the <p>&nbsp;</p>.

Edit: I'm using... Drupal 6.2, FCKEditor Module 6.x.1.2-1, FCKEditor 2.6

matkeane’s picture

For what it's worth, I had the same problem on a site. However, having an initial empty <p> tag is helpful in that when users start typing, or paste something in, their content is wrapped in the tag - otherwise, they tended to submit text without any wrapped tag.

I guess it would be nice to have the option for 'inital blank paragraph' in the config somewhere, but I'm guessing that would require a change to the editor code itself, and not just the Drupal module, as I'm pretty sure it's FCKeditor inserting those tags (try switching between code/source view and deleting them - they magically reappear!).

The solution I opted for was to scan the text field when the form was submitted (using the submit op in the node_api hook) and strip any empty <p> tags with a regexp. Maybe not the most elegant solution, but it works for me...

wwalc’s picture

Hmm it seems that removing this code from fckeditor.utils.js fixes this issue:

	// -- some hacks for IE
	var oldCheckAndRemovePaddingNode = editorInstance.EditorWindow.parent.FCKDomTools.CheckAndRemovePaddingNode ;

	editorInstance.EditorWindow.parent.FCKDomTools.CheckAndRemovePaddingNode = function( doc, tagName, dontRemove )
	{
		try
		{
			oldCheckAndRemovePaddingNode( doc, tagName, dontRemove ) ;
		}
		catch(e)
		{}
	}

	editorInstance.Events.FireEvent = function( eventName, params )
	{
		try
		{
			return editorInstance.EditorWindow.parent.FCKEvents.prototype.FireEvent.call( this, eventName, params ) ;
		}
		catch(e)
		{}
	}
	// -- some hacks for IE

the sad thing is that I don't remember why I added this code, obviously some time ago something was wrong in IE with some version of FCKeditor... but at this moment removing this code doesn't seem to break anything and it was ugly hack by the way.

So, if there is anyone willing to remove this code and test if it works, please leave here your comments.

wwalc’s picture

Status: Active » Fixed

Ok... committed. Let's keep fingers crossed that this hack was not needed anymore.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

julien.reulos’s picture

Version: 6.x-1.1 » 5.x-2.1
Status: Closed (fixed) » Fixed

I removed the code and it works great: i edited a node that had <p>&nbsp;</p> thing and when saved it my text didn't have the extra paragraph anymore . I re-edited other time and <p>&nbsp;</p> wasn't in the fckeditor window.
Both with IE and Firefox.
The hack doesn't seem to break anything in drupal.
Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

buchannon’s picture

THANK YOU for the fix wwalc - this was screwing up a bunch of stuff on a site that I've been working on and once I removed that chunk of code and refreshed my cache, all was well.

cosmogenesis’s picture

I just installed the latest version of this module and I'm getting an errant initial field value of   The code to be removed identified above does not currently exist in the js file.

marina_v’s picture

Status: Closed (fixed) » Needs work

subscribing under #9
the latest version of the module does not contain the code from above, but has the same bug. how could i fix it now?:)

stevenator’s picture

subscribing under #10. I am having the same issue as well with the latest version of fckeditor. I don't know if anyone is using this with Wysiwyg but I am not seeing this when using the module this way.

Road Kill’s picture

Hi having the same problem here have you found any solution to this problem.

Jorrit’s picture

Status: Needs work » Closed (won't fix)

Try CKEditor.