この作業はそれほど簡単ではありません(これも苦労しなければなりませんでした)。独自のカスタムプラグインの1つで関数createControlを設定する必要があります。私はあなたに正しい方向を向けるべきである私自身のプラグインの1つのいくつかのコードをあなたに見せます
/**
* Creates control instances based in the incomming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those.
*
* @param {String} n Name of the control to create.
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
* @return {tinymce.ui.Control} New control instance or null if no control was created.
*/
// Creates a custom listbox
createControl: function(n, cm) {
switch (n) {
// you may define more than one listbox here!
// make sure this string is in your buttonconfig
case 'my_new_listbox':
var listboxIdPart = 'my_new_listbox';
// Listbox erzeugen
var ctrl = cm.createListBox(listboxIdPart, {
title : 'Title',
// v could be 'value1_here' or "value2_here", it isbest to use simple numers as values
//need to specify what shall happen depending on the value
onselect : function(v) {
if (v == 0){
return;
}
else {
// alert('value choosen:' + v)
// your actions here
return;
}
}
}); // closing bracket
// Add entries to the dropdown
ctrl.add('entry1', 'value1_here');
ctrl.add('entry2', 'value2_here');
ctrl.add('entry3', 'value3_here');
// Return new listbox
return ctrl;
}
return null;
},