Opened 10 years ago

Closed 5 years ago

#1858 closed Bug (fixed)

FF:cannot format entire table column - adds code outside <td></td> tags of 1st cell

Reported by: Tanya Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.5.1
Keywords: HasPatch Firefox Cc:

Description

To replicate the bug, create a table with more than one row, enter text into cells then select content of an entire column or row. Select a formatting option such as BOLD or Right Align. Result: firstly, the entire column is not affected secondly, the first cell stuffs up. In the right align example (shown below) the first <td> is altered, placing two empty <p> tags and css styles. In the editor it looks like another cell has been added to the table.

I get a similar issue when trying to format the whole table as "normal" paragraph text.

<table border="1" cellpadding="0" cellspacing="0">

<tbody>

<tr>

<p style="text-align: right;">&nbsp;</p> <td style="text-align: right;">aaaaa</td> <p style="text-align: right;">&nbsp;</p> <td>aaa</td>

</tr> <tr>

<td>aa</td> <td>aa</td>

</tr>

</tbody>

</table>

Attachments (3)

TC_1858_FF.png (1.6 KB) - added by Wojciech Olchawa 10 years ago.
TC_1858_IE.png (1.2 KB) - added by Wojciech Olchawa 10 years ago.
fckjustifycommands.js.patch (3.9 KB) - added by Karen Ananiev 10 years ago.
I'm not sure that it is good solution but it works :)

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by Wojciech Olchawa

Keywords: Confirmed Firefox added
Summary: cannot format entire table column - adds code outside <td></td> tags of 1st cellFF:cannot format entire table column - adds code outside <td></td> tags of 1st cell

Confirmed in FF. Works fine with IE.

This bug is a little bit more complicated. Following your example I will write another step by step instruction to reproduce this bug.

1. Create a 3 row table with th sample code below:

<table width="200" cellspacing="1" cellpadding="1" border="1">
    <tbody>
        <tr>
            <td>cell1</td>
            <td>cell2</td>
        </tr>
        <tr>
            <td>cell3</td>
            <td>cell4</td>
        </tr>
        <tr>
            <td>cell5</td>
            <td>cell6</td>
        </tr>
    </tbody>
</table>

2. Highlight the first row and press Right Justify button.

3. The result is:

<table width="200" cellspacing="1" cellpadding="1" border="1">
    <tbody>
        <tr>
            <p style="text-align: right;">&nbsp;</p>
            <td style="text-align: right;">cell1</td>
            <p style="text-align: right;">&nbsp;</p>
            <td>cell2</td>
        </tr>
        <tr>
            <td>cell3</td>
            <td>cell4</td>
        </tr>
        <tr>
            <td>cell5</td>
            <td>cell6</td>
        </tr>
    </tbody>
</table>

The expected behavior would be to have a code like this:

<table cellspacing="1" cellpadding="1" width="200" border="1">
    <tbody>
        <tr>
            <td style="text-align: right">cell1</td>
            <td style="text-align: right">cell2</td>
        </tr>
        <tr>
            <td>cell3</td>
            <td>cell4</td>
        </tr>
        <tr>
            <td>cell5</td>
            <td>cell6</td>
        </tr>
    </tbody>
</table>

So Firefox messes up the table. I've added to screenshots to show the results.

It is possible that we have a ticket opened for this bug. I will look it out.

Changed 10 years ago by Wojciech Olchawa

Attachment: TC_1858_FF.png added

Changed 10 years ago by Wojciech Olchawa

Attachment: TC_1858_IE.png added

comment:2 Changed 10 years ago by Wojciech Olchawa

Milestone: FCKeditor 2.7

#1758 has been marked as DUP

Changed 10 years ago by Karen Ananiev

Attachment: fckjustifycommands.js.patch added

I'm not sure that it is good solution but it works :)

comment:3 Changed 10 years ago by Karen Ananiev

Keywords: HasPatch added

It seems that CreateBookmark creates <span>s between <td>s when some cells are selected.

comment:4 Changed 9 years ago by jorenm@…

I don't know if that patch works or not, because I do not know how to apply it. It's still broken in the newest version of FCK though, so this is the solution that fixed it for me:

// Check if there are selected cells, if there are then move the selection 
// inside the TDs so the following while loop works properly
        
// Don't create a bookmark in firefox as it won't reselect the table cells as 
// they were before, and firefox doesn't lose the selection in the iframe anyway.
var tds = FCKTableHandler.GetSelectedCells();
if (tds && FCKBrowserInfo.IsGecko) {
    range.SetStart(tds[0], 1);
    range.SetEnd(tds.last(), 1);
} else {
// Store a bookmark of the selection since the paragraph iterator might
// change the DOM tree and break selections.
    var bookmark = range.CreateBookmark();
}

And then make sure bookmark exists.

if (bookmark) {
    range.MoveToBookmark( bookmark ) ;
    range.Select() ;
}      

comment:5 Changed 5 years ago by Jakub Ś

Resolution: fixed
Status: confirmedclosed

No longer reproducible in CKEditor.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy