Skip to content

Commit

Permalink
Merge branch 't/10472' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Comandeer committed Jan 27, 2017
2 parents 8c3adbb + 28f2be5 commit ebe3d3e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -8,6 +8,7 @@ Fixed Issues:
* [#16811](http://dev.ckeditor.com/ticket/16811): Fixed: Pasted from Word table alignment not preserved.
* [#16810](http://dev.ckeditor.com/ticket/16810): Fixed: Vertical align in tables not supported by [Paste from Word](http://ckeditor.com/addon/pastefromword) plugin.
* [#11956](http://dev.ckeditor.com/ticket/11956): [Blink, IE] Fixed: [Link](http://ckeditor.com/addon/link) dialog does not open on a double click on the second word of the link with background color or other styles.
* [#10472](http://dev.ckeditor.com/ticket/10472): Fixed: Unable to use [Table Resize](http://ckeditor.com/addon/tableresize) on table's header and footer.

## CKEditor 4.6.2

Expand Down
26 changes: 19 additions & 7 deletions plugins/tableresize/plugin.js
Expand Up @@ -60,7 +60,18 @@
// Get the tbody element and position, which will be used to set the
// top and bottom boundaries.
var tbody = new CKEDITOR.dom.element( table.$.tBodies[ 0 ] ),
tbodyPosition = tbody.getDocumentPosition();
pillarPosition = tbody.getDocumentPosition(),
pillarHeight = tbody.$.offsetHeight;

if ( table.$.tHead ) {
var tHead = new CKEDITOR.dom.element( table.$.tHead );
pillarPosition = tHead.getDocumentPosition();
pillarHeight += tHead.$.offsetHeight;
}

if ( table.$.tFoot ) {
pillarHeight += table.$.tFoot.offsetHeight;
}

// Loop thorugh all cells, building pillars after each one of them.
for ( var i = 0, len = $tr.cells.length; i < len; i++ ) {
Expand Down Expand Up @@ -100,9 +111,9 @@
table: table,
index: pillarIndex,
x: pillarLeft,
y: tbodyPosition.y,
y: pillarPosition.y,
width: pillarWidth,
height: tbody.$.offsetHeight,
height: pillarHeight,
rtl: rtl
} );
}
Expand All @@ -126,7 +137,7 @@
}

function columnResizer( editor ) {
var pillar, document, resizer, isResizing, startOffset, currentShift;
var pillar, document, resizer, isResizing, startOffset, currentShift, move;

var leftSideCells, rightSideCells, leftShiftBoundary, rightShiftBoundary;

Expand Down Expand Up @@ -313,7 +324,7 @@
resizer.show();
};

var move = this.move = function( posX ) {
move = this.move = function( posX ) {
if ( !pillar )
return 0;

Expand Down Expand Up @@ -388,11 +399,12 @@
return;
}

// Considering table, tr, td, tbody but nothing else.
// Considering table, tr, td, tbody, thead, tfoot but nothing else.
var table, pillars;

if ( !target.is( 'table' ) && !target.getAscendant( 'tbody', 1 ) )
if ( !target.is( 'table' ) && !target.getAscendant( { thead: 1, tbody: 1, tfoot: 1 }, 1 ) ) {
return;
}

table = target.getAscendant( 'table', 1 );

Expand Down
34 changes: 34 additions & 0 deletions tests/plugins/tableresize/manual/pillar.html
@@ -0,0 +1,34 @@
<div id="editor">
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
<thead>
<tr>
<th scope="row" style="width:227px">Header</th>
<th scope="col" style="width:90px">Header</th>
<th scope="col" style="width:165px">Header</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row" style="width:227px">Header</th>
<td style="width:90px">&nbsp;not header</td>
<td style="width:165px">not header</td>
</tr>
<tr>
<th scope="row" style="width:227px">Header</th>
<td style="width:90px">not header</td>
<td style="width:165px">not header</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row" style="width:227px">Header Footer</th>
<td style="width:90px">footer</td>
<td style="width:165px">footer</td>
</tr>
</tfoot>
</table>
</div>

<script>
CKEDITOR.replace( 'editor' );
</script>
9 changes: 9 additions & 0 deletions tests/plugins/tableresize/manual/pillar.md
@@ -0,0 +1,9 @@
@bender-ui: collapsed
@bender-tags: tc, 10472, 4.7.0
@bender-ckeditor-plugins: wysiwygarea, toolbar, table, tableresize, basicstyles, undo

Drag one of the vertical borders separating the cells (inner borders) by holding the part in the first/last row.

**Expected**: Dragging by these parts is possible, the shadowy pillar created when dragging is the height of the table.

**Unexpected**: Dragging by these parts is not possible, the shadowy pillar is shorter than the height of the table.

0 comments on commit ebe3d3e

Please sign in to comment.