2017-06-02 63 views
1

因此,我刪除了表信息對話框中的一堆按鈕。剩下的只有5個按鈕,所以在默認尺寸下感覺很空。CKEditor調整對話框中的標籤

這裏是代碼:

CKEDITOR.on('dialogDefinition', function(ev) { 
     var dialogName = ev.data.name; 
     var dialogDefinition = ev.data.definition; 
     if(dialogName == 'table' || dialogName == 'tableProperties'){ 
      var advTab = dialogDefinition.getContents('advanced'); 
      var infoTab = dialogDefinition.getContents('info'); 
      var advClass = advTab.get('advCSSClasses'); 
      var cmbAlignBut = infoTab.get('cmbAlign'); 

      infoTab.remove('txtSummary'); 
      infoTab.remove('txtCaption'); 
      infoTab.remove('selBorder'); 
      infoTab.remove('txtCellSpace'); 
      infoTab.remove('txtCellPad'); 
      infoTab.remove('selHeaders'); 
      infoTab.remove('cmbAlign'); 
      infoTab.remove('txtBorder'); 

      advClass.type = "select"; 
      advClass.requiredContent = "table(cke-xyz)"; 
      advClass.label = "Table Type"; 
      advClass.default = "normal-table"; 
      advClass.items = [ 
       ["Normal", "normal-table"], 
       ["Comparison", "comparison-table"], 
       ["Links", "link-table"] 
      ]; 

      infoTab.add(advClass); 

      dialogDefinition.removeContents('advanced'); 
      console.log(advClass); 
      console.log(cmbAlignBut); 
     } 
    }); 

這裏是它的樣子:

And here's how it looks like:

如何調整至少高度?

回答

1

請參見:https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/table/dialogs/table.js#L60 對話框通常會被分配minHeight。如果你想改變它,請使用:

CKEDITOR.on('dialogDefinition', function(ev) { 
    var dialogName = ev.data.name; 
    var dialogDefinition = ev.data.definition; 
    if(dialogName == 'table' || dialogName == 'tableProperties'){ 
    ev.data.definition.minHeight = 120; // you can also use ev.data.definition.minHeight = 0; 
    ...