Substituting (via copy-pasting) one table-row with another fails
Categories
(Core :: DOM: Editor, defect, P2)
Tracking
()
People
(Reporter: matteo.sindona, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Steps to reproduce:
-
Go here https://test.totallympics.com/
-
Login with
username: Totallympics
password: totallympics -
Go here https://test.totallympics.com/topic/198-test/?do=edit
-
You will see a table with 4 rows and you can edit it
-
Select the first row (cells 1-4) cells with your mouse and copy
-
Select the second row (cells 5-8) cells with your mouse and paste
Actual results:
The 4 cells are all copied inside the cell 5, with cell 6-7-8 moved in the right of the table after cell 2-3-4, and the table becomes a mess
Video of what happens (editor using HTML code): https://youtu.be/48fePpxOQcQ
Expected results:
When the number of columns selected in the copied row and in the paste row are the same (like in our case), the whole row should be copied-pasted. So cell 1 should go in place of cell 5, cell 2 in place of cell 6, cell 3 in place of cell 7 and cell 4 in place of cell 8.
Video of what SHOULD happen (editor using BB code): https://youtu.be/TdVP-gm-zgU
| Reporter | ||
Updated•5 years ago
|
| Reporter | ||
Comment 1•5 years ago
|
||
So basically this is the html code of what is copied:
<td>
1
</td>
<td>
2
</td>
<td>
3
</td>
<td>
4
</td>
And when I select cells 5-6-7-8, only cell 5 code is selected, so the result will be:
<td>
1
</td>
<td>
2
</td>
<td>
3
</td>
<td>
4
</td>
<td>
6
</td>
<td>
7
</td>
<td>
8
</td>
Being also cells 6-7-8 selected, <td>6</td>, <td>7</td>, <td>8</td> should disappear when I paste the other row.
| Reporter | ||
Comment 2•5 years ago
|
||
The correct behaviour should be from:
<tr>
<td>
5
</td>
<td>
6
</td>
<td>
7
</td>
<td>
8
</td>
</tr>
to (after paste):
<tr>
<td>
1
</td>
<td>
2
</td>
<td>
3
</td>
<td>
4
</td>
</tr>
Matteo, thanks for again reporting a <table> issue.
Interestingly, when copying a table-row from https://test.totallympics.com/topic/198-test/?do=edit, the clipboard lacks "text/_moz_htmlcontext" and "text/_mozhtmlinfo" flavors. Haven't seen this before.
When copying a <table> from another source, e.g. https://www.w3schools.com/html/html_tables.asp, the clipboard contains those flavors. I suspect the other table from which you copied yields those flavors too.
Matteo: does this work in Chrome?
| Reporter | ||
Comment 5•5 years ago
|
||
Hello Mirko,
thank you for your reply and the time you spend into these issues!
I have copied a table from w3schools here https://test.totallympics.com/topic/198-test/?do=edit below the other one, and the behaviour is the same.
In Chrome does not work, but this is because in Chrome is not even possible to select cells horizontally like I do with Mozilla (and that's why I love Mozilla, it's surely the best to work with tables). With Chrome I select the text, with Mozilla I select the cells and that's exactly what I need, but unfortunately here I can not copy-paste them.
I also show you an example of a table where this problem does not happen.
Go here: https://results.totallympics.com/forum.php?mod=post&action=edit&fid=100&tid=2897&pid=44255&page=1
login with
username: test
password: test
Do the same steps you did for the other website, and you will see the rows are correctly copied (if the number of columns selected is the same of course). This website uses BB code, the other one (where the problem happens) HTML code.
Thank you again and I hope this problem can be fixed in the future.
Matteo
Go here: https://results.totallympics.com/forum.php?mod=post&action=edit&fid=100&tid=2897&pid=44255&page=1
login with
username: test
password: testDo the same steps you did for the other website, and you will see the rows are correctly copied (if the number of columns selected is the same of course). This website uses BB code, the other one (where the problem happens) HTML code.
Thanks for the credentials and steps to reproduce. Indeed, the clipboard flavors contain:
"text/html" flavor:
<meta http-equiv="content-type" content="text/html; charset=utf-8"><table class="t_table" width="500"><tbody><tr><td>5</td><td>6</td><td>7</td><td>8</td></tr></tbody></table>
"text/_moz_htmlcontext" flavor:
<html><body spellcheck="false" style="height: 400px;" contenteditable="true"><table class="t_table" width="500"><tbody></tbody></table></body></html>
"text/_moz_htmlinfo" flavor:
0,0
I've briefly investigated the issue, but it's not obvious, why the issue occurs for the one page but not for the other.
| Reporter | ||
Comment 8•5 years ago
|
||
I am surely not an expert, but the only big difference I notice between the two pages is one page is using HTML code (and the problem occurs) and the other page is using BB code (and the problem does NOT occur).
With BB code this is the pasted text (which is correct):
[tr][td]1[/td][td]2[/td][td]3[/td][td]4[/td][/tr]
With HTML code this is the pasted text:
<td>
1
</td>
<td>
2
</td>
<td>
3
</td>
<td>
4
</td>
The pasted text per se is correct, the probelm is that this part is not deleted:
<td>
6
</td>
<td>
7
</td>
<td>
8
</td>
This part of the HTML code should be deleted if the cells are selected before pasting.
Thank you!
https://test.totallympics.com/topic/198-test/?do=edit uses CKEditor. Couldn't figure out which version, but according to the website's JS it's from 2020: Copyright (c) 2003-2020, CKSource - Frederico Knabben..
I suspect CKEditor fills the clipboard itself and I'm not sure if this Gecko-specific functionality can be adapted to be able to deal with this. Need to think about it.
Description
•