Ticket #6485 (reopened defect)

Opened 8 months ago

Last modified 1 month ago

wpautop removes closing P tag from empty paragraph above a table

Reported by: jpxwordpress Assigned to: anonymous
Priority: low Milestone: 2.8
Component: TinyMCE Version: 2.5
Severity: minor Keywords: wpautop
Cc:

Description

The WYSIWIG editor for WP 2.5 does not keep previous content "intact" upon editing a post, as promised:

http://wordpress.org/development/2008/03/wordpress-25-brecker/ Friendlier visual post editor — I’m not sure how to articulate this improvement except to say “it doesn’t mess with your code anymore.” We’re now using version 3.0 of TinyMCE, which means better compatibility with Safari, and we’ve paid particular attention this release to its integration and interaction with complex HTML...

For example, the first post I tried to make and then edit after going from 'HTML' to 'Visual' mode in the post editing window garbled the appearance of the post immediately after I hit 'SAVE'. What it did, specifically, was move different lines of text too close together/took out line breaks I had wanted, and reduced size of font on some lines with links.

[The browser I am using is Mozilla Firefox 2.0.0.13]

Thank you very much for any feedback you can provide me with to help correct this.

Kevin Pajak – Webmaster, jpopexpress.com

My site’s WordPress Blog: http://www.jpopexpress.com/blog/

Change History

03/31/08 16:55:26 changed by lloydbudd

  • keywords changed from wysiwig editor alters text to wysiwig editor alters text, needs-info.
  • status changed from new to closed.
  • resolution set to invalid.
  • milestone deleted.

Hi Kevin, thank you for reporting these issues. Can you please provide specific steps to reproduce the problem?

Closing as invalid for now.

05/06/08 18:11:01 changed by Jairus

  • status changed from closed to reopened.
  • resolution deleted.

To reproduce, put the following code into a new post, in tinymce's HTML view:

<p class="rxbodyfield">&nbsp;</p>

<table>
<tr>
<td>Foo</td>
</tr>
<tr>
<td>Foo</td>
</tr>
</table>

<p class="rxbodyfield">&nbsp;</p>

Switch to Visual view. Put two linebreaks after the F in the first Foo. Switch to HTML. Switch to Visual. Switch to HTML. Switch to Visual. The linebreaks are now gone.

05/06/08 18:11:31 changed by Jairus

  • keywords changed from wysiwig editor alters text, needs-info to wysiwig editor alters text.

(in reply to: ↑ description ; follow-up: ↓ 5 ) 05/07/08 17:48:53 changed by azaozz

  • keywords changed from wysiwig editor alters text to wpautop.
  • priority changed from high to low.
  • summary changed from WP 2.5 WYSIWIG editor alters post data while editing to wpautop removes closing P tag from empty paragraph above a table.
  • severity changed from major to minor.
  • milestone set to 2.7.

Replying to jpxwordpress:

For example, the first post I tried to make and then edit after going from 'HTML' to 'Visual' mode in the post editing window garbled the appearance of the post immediately after I hit 'SAVE'. What it did, specifically, was move different lines of text too close together/took out line breaks I had wanted, and reduced size of font on some lines with links.

Line spacing and font size is controlled by your theme's style.css. Trying to alter appearance by adding empty <p> and <br /> tags is an outdated practice, so wpautop removes them.

Looking at your example: if you want more space around the table, why not make a new style for it in style.css, or even add inline style (if you want it only on this table)? Also for using tables in TinyMCE, you will need to add the "table" plugin for it or install a WordPress plugin that adds it.

The only error here seems to be that wpautop removes the closing </p> tag when an empty paragraph is immediately above a table, which is a very rare case as tables are not supported by default in the WYSIWYG editor and empty paragraphs are considered bad html coding practice.

(in reply to: ↑ 4 ; follow-up: ↓ 6 ) 05/09/08 19:02:36 changed by Jairus

Replying to azaozz:

The only error here seems to be that wpautop removes the closing </p> tag when an empty paragraph is immediately above a table, which is a very rare case as tables are not supported by default in the WYSIWYG editor and empty paragraphs are considered bad html coding practice.

Linebreaks within table cells are being removed. That's a pretty big deal.

(in reply to: ↑ 5 ) 10/10/08 08:30:58 changed by azaozz

Replying to Jairus:

Linebreaks within table cells are being removed. That's a pretty big deal.

If by linebreaks you mean <br /> tags, no they are not removed. Hard line breaks "\n" does not matter in HTML unless in <pre> tag.

10/14/08 01:01:18 changed by matt

  • milestone changed from 2.7 to 2.8.

10/23/08 01:17:25 changed by jacobsantos

  • component changed from General to TinyMCE.