Opened 12 years ago
Closed 8 years ago
#9944 closed Bug (duplicate)
insertcellbefore and insertcellafter in nested tables is incorrect
Reported by: | Michiel Overeem | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Tables | Version: | 3.0 |
Keywords: | Cc: |
Description
The insertcellbefore and insertcellafter commands from the tabletools plugin is incorrect. The insertCell function found in this plugin looks for the first tablecell (td) ascendant. If there is none, it looks for the first table-header-cell (th) ascendant. It does not check if the cell is a child of the current table. If the tables are nested, or the editor itself is nested inside of a table, the cell is added to the incorrect table. I've attached a corrected function that can be used to patch this bug.
Attachments (2)
Change History (8)
Changed 12 years ago by
Attachment: | tabletools_insertcell.js added |
---|
Changed 12 years ago by
Attachment: | tabinsertcellproblem.html added |
---|
Sample file to illustrate the problem
comment:1 Changed 12 years ago by
Attached is a sample file to show the problem. Inserting a cell from the contextmenu in the first cell ('header one') inserts the cell in the outer table, which is not part of the contenteditable element. Inserting in the cells on row two ('cell one' and 'cell two') works correct.
comment:2 Changed 12 years ago by
The same problem is present in the getSelectedCells function inside the plugin.
comment:3 Changed 12 years ago by
Keywords: | tabletools insertcell removed |
---|---|
Status: | new → confirmed |
Version: | 4.0.1 → 3.0 |
- Problem can be reproduced from CKEditor 3.0 in both 3.x and 4.x.
- Just put cursor in header cell and select insert cell before or after
Result: Cell will be inserted in outer table
The same thing can be reproduced with iframed editor with below code:
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"> <tbody> <tr> <td> </td> <td> <p> </p> <p> </p> <table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"> <thead> <tr> <th scope="col"> </th> <th scope="col"> </th> </tr> </thead> <tbody> <tr> <td> </td> <td> </td> </tr> </tbody> </table> <p> </p> </td> <td> </td> </tr> </tbody> </table>
comment:4 Changed 12 years ago by
@michielovereem - To get your proposed fix tested and applied (if it is correct) please fork CKEditor 4 code from https://github.com/ckeditor/ckeditor-dev, prepare your fix and make a "pull request" (here is the example list of pull requests https://github.com/ckeditor/ckeditor-dev/pulls?direction=desc&page=1&sort=created&state=open). In comment please specify link to bug for which this fix was prepared. This is much faster way to get proposed fix implemented/rejected (if they are invalid). At least in V4.
In CKEditor 3.x we go through proposed SVN patches every couple of weeks (sometimes moths) and decide whether to apply them or not. This of course takes more time then pull requests on github but this is what versioning system offered and we had to adjust to it.
comment:5 Changed 12 years ago by
Added pull request with the required fix: https://github.com/ckeditor/ckeditor-dev/pull/36
comment:6 Changed 8 years ago by
Resolution: | → duplicate |
---|---|
Status: | confirmed → closed |
This is a duplicate of #11192. @michielovereem I will move your pull request there.
corrected insertCell function