Opened 13 years ago
Last modified 12 years ago
#8177 confirmed Bug
Splitting cell vertically, causing incorrect rowspan.
Reported by: | Krzysztof Studnik | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Tables | Version: | 3.1 |
Keywords: | Cc: |
Description
Environment
Related to #6111
TC
- Open editor and insert table:
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"> <tbody> <tr> <td colspan="2" dir="rtl"> <strong>1</strong></td> <td colspan="2"> <strong>2</strong></td> </tr> <tr> <td> <strong>3</strong></td> <td> podział poziomy ltr</td> <td dir="rtl"> <strong><u>4</u></strong></td> <td dir="rtl"> podział poziomy rtl</td> </tr> <tr> <td colspan="2" dir="rtl" rowspan="3"> <strong>5</strong></td> <td colspan="2"> <strong>6</strong></td> </tr> <tr> <td colspan="2"> podział pionowy ltr</td> </tr> </tbody> </table> <p> </p>
- Switch to wysiwyg, and set cursor in cell with no. 1
- from context menu select Cell - split vertically.
Actual result
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;"> <tbody> <tr> <td colspan="2" dir="rtl"> <strong>1</strong></td> <td colspan="2" rowspan="3"> <strong>2</strong></td> </tr> <tr> <td colspan="2" dir="rtl"> podział pionowy rtl</td> </tr> <tr> <td> <strong>3</strong></td> <td> podział poziomy ltr</td> <td dir="rtl"> <strong><u>4</u></strong></td> <td dir="rtl"> podział poziomy rtl</td> </tr> <tr> <td colspan="2" dir="rtl" rowspan="3"> <strong>5</strong></td> <td colspan="2"> <strong>6</strong></td> </tr> <tr> <td colspan="2"> podział pionowy ltr</td> </tr> </tbody> </table> <p> </p>
Change History (5)
comment:1 Changed 13 years ago by
Summary: | Splitting cell vertically, causing incorrect colspan. → Splitting cell vertically, causing incorrect rowspan. |
---|
comment:2 Changed 13 years ago by
Status: | new → confirmed |
---|---|
Version: | 3.2 → 3.1 |
comment:3 Changed 13 years ago by
comment:4 Changed 13 years ago by
The same broken table structure is produced it TC presented in #9020. Perhaps these two bugs use the same invalid code and they can be fixed with one patch.
comment:5 Changed 12 years ago by
#9037 was marked as duplicate.
Proposed fix presented in that ticket:
This bug is in "verticalSplitCell" function. When figuring out where to insert the new cell by checking the virtual row, the index is wrong. My fix:
var currentIndex = 0; // Figure out where to insert the new cell by checking the vitual row. for ( var c = 0; c < newCellRow.length; c++ ) { candidateCell = newCellRow[ c ]; // Catch first cell actually following the column. if ( candidateCell.parentNode == newCellTr.$ && currentIndex > colIndex ) { var candidateCKCell = new CKEDITOR.dom.element( candidateCell ) ; newCell.insertBefore(candidateCKCell); break; } else{ if (candidateCell.colSpan>1){ currentIndex = currentIndex + candidateCell.colSpan; }else{ currentIndex = currentIndex + 1; } candidateCell = null; } }
Cell number two gets rowspan="3". If you change it to rowspan="2" everything gets back to normal.
For a minute there I thought that perhaps cell 5 with rowspan="3" is causing this but cell number 2 gets rowspan=3 even if you remove rowspan from cell number 5.
I've been able to reproduce it from CKEditor 3.1