Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#41371 closed defect (bug) (worksforme)

Copy & paste of html tables stopped working

Reported by: irzig's profile irzig Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9
Component: TinyMCE Keywords:
Focuses: Cc:

Description

Dear WordPress team,
we are experiencing a problem after upgrading to 4.8. Copy and Paste of tables using the visual editor copies only the content of the first cell.

Steps to reproduce:

  1. create a new article
  2. insert a new table by changing to text mode and pasting the following html code:
    <table><tbody><tr><td>R1C1</td><td>R1C2</td></tr><tr><td>R2C1</td><td>R2C2</td></tr></tbody></table>
    
  3. go back to visual mode
  4. create a copy of the table (Ctrl+C, Ctrl+V)

Expected result: two copies of the same table, and this worked reliably a couple of weeks ago

Actual result: Only the content of the first cell (R1C1 in this case) is pasted.

I also tried, instead of step 2, to create a table in Word (or rather LibreOffice) and copy it over to the editor. However, same result after step 4.

Please, can anybody verify that this is a bug?

Since it also is about losing information by copying, I feel like this might be related to #41026.

Change History (4)

#1 @joyously
7 years ago

I can confirm that following the steps on 4.7.5, the entire table is copied and pasted.
Since my test included upgrading to 4.8 in order to test, I had the table still in the clipboard. Pasting it into the 4.8 editor worked correctly. But starting over from step 1, I copied the table again and when I pasted, I got only the first cell instead of the whole table. So I can confirm that it does not work on 4.8.
Definitely the only difference between my tests was WP version.

As an aside: This test highlights the fact that the visual editor has a keyboard and mouse trap if the table is the last thing. You can't seem to go past it except by switching to Text mode. I pasted my second table preceding the first one because of this.

#2 @azaozz
7 years ago

Can reproduce it too. Selecting a table inside the Visual editor doesn't work as before. This comes from upstream, will report it there.

The workaround is to make sure the whole table is selected before copying. Steps:

  1. Click inside the table.
  2. Open the second toolbar so the "Path" toolbar is shown at the bottom.
  3. Click on the table breadcrumb in the "Path" toolbar.

Now the whole table is selected and can be copied as usual.

Version 1, edited 7 years ago by azaozz (previous) (next) (diff)

#3 @azaozz
7 years ago

  • Component changed from Editor to TinyMCE
  • Milestone changed from Awaiting Review to Future Release

#4 @azaozz
5 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Still need to be careful and select the whole table before copying. However this is now superseded by the block editor. The Table block there works well.

Closing as worksforme, feel free to reopen with a patch or some (pseudo) code showing how to make this better.

Note: See TracTickets for help on using tickets.