Developer forum

Forum » Feature requests » editor table standard values

editor table standard values

Nuno Aguiar
Reply

Hi,

 

The editor's standard table has some values that are not W3C valid. Example:

   
   
   

If we could set the default values and attributes would be great to help the customer keep a W3C valid website, with little/no HTML knowledge

 

Nuno


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

This is a known issue (bug) with CKEditor (cf. http://dev.ckeditor.com/ticket/10021) and there is no easy fix.

The best we can come up with right now is adding this to your configuration file

CKEDITOR.on('dialogDefinition', function(ev) {
  var dialogName = ev.data.name;
  var dialogDefinition = ev.data.definition;

  if (dialogName === 'table') {
    var infoTab = dialogDefinition.getContents('info');
    infoTab.remove('txtCellSpace');
    infoTab.remove('txtCellPad');
    infoTab.remove('txtBorder');
    infoTab.remove('txtWidth');
    infoTab.remove('txtHeight');
  }
});

This removes the settings for "cellspacing", "cellpadding", "border", "width" and "height" from the table dialog (A huge thank you goes out to http://ckeditor.com/comment/54582#comment-54582).

When editing existing tables (having the unwanted attributes) the attributes should be removed and this can be done using something like

CKEDITOR.on('dialogDefinition', function(ev) {
  var dialogName = ev.data.name;
  var dialogDefinition = ev.data.definition;

  if (dialogName === 'table') {
    var infoTab = dialogDefinition.getContents('info');
    infoTab.get('txtCellPad').commit = function(data, table) { table.removeAttribute('cellPadding'); }
  }
});

It's not very beautiful solutions, but it's the best we can do right now without having to break open the CKEditor core and start hacking it.

Best regards,
Mikkel 

Votes for this answer: 1
 
Nuno Aguiar
Reply

Hi Mikkel,

 

Get's the job done for now. Fixes problems with non-technical and high demanding clients

 

Thanks

 
Mikkel Ricky
Reply

Have you considered using item rather than (handwritten) tables?

It may be much easier to edit the data using items, and you get much more control over the actual output in the frontend. 

 
Nuno Aguiar
Reply

Hi Mikkel,

 

Yes, we are migrating everything to Items, but we still need to make sure that if our client uses a table through the rich text editor, it will work accuratly.

 

Just waiting for Item Statistics to completly abandon the News module :)

 

Nuno