Reputation: 35
Hi, I have problem how to create a custom dropdown menu like formats in tiny mce
So, I want to create a custom dropdown menu and there have several of custom inline tagging inside. For example :
<question></question>
<answer></answer>
<hint></hint>
I was reffering to references in tiny mce about 2 example :
1- Custom formats http://codepen.io/tinymce/pen/QjzgRW
2- Custom dropdown http://codepen.io/tinymce/pen/JYwJVr
But, I'm still stuck to modified them and create custom inline tagging in new dropdown, help me please :)
Upvotes: 0
Views: 214
Reputation: 247
Hi try to add this code in your one of your plugins code :
var items = [];
editor.addMenuItem('questionitem', {
text: 'question',
cmd : function(){
editor.insertContent('your custom tag');
}
});
items.push(editor.menuItems['questionitem']);
editor.addButton('customdropdown', function () {
return {
type: 'listbox',
text: 'Formats',
tooltip: 'Formats',
values: items,
};
});
Don't forgot to add customdropdown btn in your toolbar.
Upvotes: 1