2012-03-21 43 views
1

大衆,TinyMCE表格控制是大的,我怎麼能把它顯示爲菜單?

我得到了一些TinyMCE框與「tablecontrols」,但contolls有9個按鈕......很遠。我如何顯示這個菜單?

乾杯, 斯特凡

+0

請描述這一點,圖像也會有所幫助 – Thariama 2012-03-21 10:25:24

+0

我認爲我不需要那些知道tinyMCE tablecontrols的人使用的圖像。表控件在導航中有11個按鈕,我想擺脫這個混亂。我希望tablecontrol顯示爲類似字體菜單的菜單。 – 2012-03-21 11:58:41

+0

好吧,明白了。我不習慣表格功能。你想要什麼我可能我想,但會花費一些努力 – Thariama 2012-03-21 12:06:38

回答

1

我花了一些時間來找到你一個解決方案了。這可能是claviska如何開發他的table-dropdown-plugin的方式,但它可以用於使用自己的tinymce命令創建任何下拉菜單。

您需要將'my_list'添加到您的按鈕列表中。 可以使用an own plugin(這不難寫)來創建自己的控件(列表下拉列表)。在那裏,你使用下面的函數

createControl: function(n, cm) { 

     switch (n) { 

      case 'my_list': 

       listboxIdPart = 'my_list'; 

       console.log('cm:', cm); 

       var ctrl = cm.createListBox(listboxIdPart, { 
        title : 'My list!', //optional 
        onselect : function(v) { 

        switch (v){ 

         case '0': 
          tinymce.activeEditor.execCommand('mceTableMergeCells'); 
          return; 
         } 
         case '1': 
          tinymce.activeEditor.execCommand('mceTableSplitCells'); 
          return; 
         } 
         case '2': 
          tinymce.activeEditor.execCommand('mceTableDeleteCol'); 
          return; 
         } 
         case '3': 
          tinymce.activeEditor.execCommand('mceTableDeleteRow'); 
          return; 
         } 
         // ... etc ... 
        } 
       }); 

       // add options to the list 
       // first param is the string that shows up in the list, second one is the value associated with that option 
       ctrl.add('1', '1'); // '1' or whatever name you prefer 
       ctrl.add('2', '2'); 
       ctrl.add('3', '3'); 
       // ... etc ... 

       // Return the new listbox instance 
       return ctrl; 
     } 
     return null; 
    }, 

你會發現創建列表框中的所有必要mceCommands for tables listed in the tinycme docs和additoionally下tiny_mce /插件/表/ editor_src.js線1780 FF TinyMCE的研究與開發版本(不是精縮)。這樣你就可以影響列表的外觀和感覺(應該甚至可以在列表中包含按鈕而不是文本元素)。

相關問題