Ticket #2992 (closed defect: fixed)

Opened 2 years ago

Last modified 9 months ago

HTML editor deletes rows (that have properties) from tables

Reported by: FireMotion Assigned to: anonymous
Priority: high Milestone: 2.5
Component: TinyMCE Version: 2.0
Severity: major Keywords: data-loss has-patch needs-testing
Cc:

Description (Last modified by foolswisdom)

Concerning tables: When rows have properties, and there are multiple rows in the table, all rows but the first will be deleted when you revisit the Code tab.

REPRO: always
STEPS:

1. as admin (also confirmed with author, but stripping not deleting is appropriate then)
2. In Write Post, click Code tab
3. Enter

<table>
  <tr class="toprow">
    <td>1</td>
    <td>2</td>
  </tr>
  <tr class="row2">
    <td>3</td>
    <td>4</td>
  </tr>
  <tr class="row3">
    <td>5</td>
    <td>6</td>
  </tr>
</table>

4. Click Save and Continue Editing or Visual tab 5. Click Code tab

ACTUAL RESULT

<table>
	<tr class="toprow">
		<td>1</td>
		<td>2</td>
	</tr>
</table>

ADDITIONAL DETAILS
Apparently, because the <tr> tags have properties (in this case class, but originally I was using valign properties, even though they might not be official <tr> properties), only the first row is kept. It doesn't matter how many rows there are.

Attachments

2992.diff (1.0 kB) - added by Nazgul on 08/29/07 00:51:47.

Change History

08/01/06 13:03:23 changed by markjaquith

Does your WP user have the unfiltered_html capability?

08/01/06 14:28:57 changed by firemotion

Yes. (I checked it with an admin account AND I checked the wp_options database and wp_user_roles has unfiltered_html for Administrator enabled.)

As far as I know, this bug has been there ever since the TinyMCE was introduced (it was pretty much the only reason why I disabled it -- until I decided to look what triggered it).

10/20/06 02:14:13 changed by FireMotion

  • summary changed from HTML editor eats rows with properties from tables to HTML editor deletes rows (that have properties) from tables.

11/29/06 23:51:52 changed by matt

  • milestone changed from 2.1 to 2.2.

01/10/07 21:12:55 changed by foolswisdom

  • keywords set to data-loss.
  • severity changed from major to blocker.
  • description changed.
  • milestone changed from 2.2 to 2.1.

Confirmed bug.
ENV: WP 2.1-beta1 r4716

Updating ticket description.

(follow-up: ↓ 7 ) 01/18/07 16:59:56 changed by miklb

Does this relate to if I add <div class="something">blah, blah</div> in code view, it's converted to <p class="something">blah, blah with no closing </p>?

(in reply to: ↑ 6 ) 01/18/07 17:00:59 changed by miklb

Replying to miklb:

Does this relate to if I add <div class="something">blah, blah</div> in code view, it's converted to <p class="something">blah, blah with no closing </p>?

I should add this is happening in 2.1 up through RC1.

01/18/07 22:14:40 changed by foolswisdom

miklb, it would be great if you created a new ticket and mention this ticket.

01/24/07 03:48:00 changed by foolswisdom

  • milestone changed from 2.1 to 2.1.1.

02/21/07 16:09:27 changed by Nazgul

  • milestone changed from 2.1.1 to 2.1.2.

03/28/07 00:32:30 changed by foolswisdom

  • milestone changed from 2.1.3 to 2.2.

04/14/07 16:24:16 changed by rob1n

  • component changed from Administration to TinyMCE.

Still reproducible in r5269.

05/01/07 13:58:22 changed by Nazgul

  • keywords changed from data-loss to data-loss needs-patch.
  • milestone changed from 2.2 to 2.4.

05/02/07 00:10:26 changed by foolswisdom

  • milestone changed from 2.4 to 2.3.

06/12/07 17:02:27 changed by rob1n

  • severity changed from blocker to major.

07/20/07 23:45:27 changed by karmadude

It looks like the following regular expression is causing the issue

wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js


cleanup: function(type, content) {

    ...

    case "get_from_editor":
        ...   
        //Handle table badness
        ...
        content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');

    ...

}

08/02/07 18:10:32 changed by karmadude

Anyone figured out a resolution for this issue yet?

08/29/07 00:51:47 changed by Nazgul

  • attachment 2992.diff added.

08/29/07 00:52:19 changed by Nazgul

  • keywords changed from data-loss needs-patch to data-loss has-patch needs-testing.

09/12/07 21:46:02 changed by ryan

  • milestone changed from 2.3 to 2.4 (next).

Patch looks good, but let's wait until 2.4 to get it in.

09/12/07 22:32:40 changed by andy

Patch is workable, though not perfect. I'd like to have it in 2.3.

09/13/07 03:56:30 changed by foolswisdom

  • milestone changed from 2.4 to 2.3.

01/25/08 04:40:57 changed by thee17

  • status changed from new to closed.
  • resolution set to fixed.

I'm getting

<table _moz_resizing="true">
<tbody>
<tr class="toprow">
<td>1</td>
<td>2</td>
</tr>
<tr class="row2">
<td>3</td>
<td>4</td>
</tr>
<tr class="row3">
<td>5</td>
<td>6</td>
</tr>
</tbody></table>

Therefore marking as being fixed by TinyMCE 3.0