smile
smile

Reputation: 35

(tinymce) How to create new custom inline tagging in new dropdown

Hi, I have problem how to create a custom dropdown menu like formats in tiny mce

enter image description here

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

Answers (1)

m.kerkeni
m.kerkeni

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

Related Questions