CKeditor Making percentage as default in width

573 Views Asked by At

I am using CKeditor, in creating Table by default the width is taking as px. i need only in percentage. Is there any option to make it as percentage always.

for example if i enter the width as 80 it has to take it as 80%. But now it is taking as 80px

1

There are 1 best solutions below

6
On

You will have to make that change in your config.xml file like this width['default'] = "80%";,

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

      if(diagName === 'table') {
        var infoTab = diagDefn.getContents('info');

        var width = infoTab.get('txtWidth');
        width['default'] = "80%";
      }
});

Hope this helps!