简体   繁体   English

CKeditor将百分比默认设置为宽度

[英]CKeditor Making percentage as default in width

I am using CKeditor, in creating Table by default the width is taking as px. 我正在使用CKeditor,默认情况下创建表格时宽度为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%. 例如,如果我输入宽度为80,则必须将其设为80%。 But now it is taking as 80px 但现在是80px

You will have to make that change in your config.xml file like this width['default'] = "80%"; 您必须像这样的width['default'] = "80%";一样在config.xml文件中进行更改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! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM