Opened 11 years ago
Last modified 9 years ago
#10682 confirmed Bug
Cannot set tablet headers back to None on table with one row
Reported by: | nitesh | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.2 |
Keywords: | Cc: |
Description
When a table has one row, and Headers are set to Both. It is not possible to go back into table properties and set the headers back to None.
Steps to reproduce:
- Create a table with 1 row, 2 columns, Headers: Both
- Enter Table Properties and set Headers: None
- Click OK
Expected results:
- Dialog exits and TH in the table are replaced with TD.
Actual results:
- Dialog does not exit and there is a JavaScript error.
Here is one possible fix, applied to ckeditor/_source/plugins/table/dialogs/table.js (Note that this code segment is from version 3.6.5, although the bug is present in the latest version too):
// Move the row out of the THead and put it in the TBody: thead = new CKEDITOR.dom.element( table.$.tHead ); tbody = table.getElementsByTag( 'tbody' ).getItem( 0 ); var previousFirstRow = tbody.getFirst(); while ( thead.getChildCount() > 0 ) { theRow = thead.getFirst(); for ( i = 0; i < theRow.getChildCount() ; i++ ) { var newCell = theRow.getChild( i ); if ( newCell.type == CKEDITOR.NODE_ELEMENT ) { newCell.renameNode( 'td' ); newCell.removeAttribute( 'scope' ); } } if ( previousFirstRow ) theRow.insertBefore( previousFirstRow ); else theRow.appendTo( tbody ); } thead.remove();
Attachments (2)
Change History (4)
comment:1 Changed 11 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 9 years ago by
Added two files for the changes required to fix this issue and add a table footer option as well.
Problem can be reproduced from CKEditor 3.0 in all browsers.
Message: Cannot read property '$' of null
Line: 189
URI: /ckeditor4/core/dom/node.js