Search code examples
javascripttinymcewysiwyg

TinyMCE: Styles dropdown not getting populate


At first sorry for my poor English. My problem is that i am init tinyMCE:

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : 'testClass',
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    plugins: "pagebreak,fullscreen,media,advimage,paste,searchreplace,advlink",
    theme_advanced_buttons1 : "save_button,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,styleselect",
    theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,|,anchor,|,image,|,cleanup,|,help,|,code",
    theme_advanced_buttons3 : "hr,removeformat,|,visualaid,|,sub,sup,|,charmap",
});

But on page i see Styles dropdown and it is not opening, when i am click on it. Please, help. What i am missed or doing wrong?


Solution

  • You can add style_formats to add styles to the TinyMCE editor. See this fiddle for example.

    I usually have all my styles defined in an external css file and use content_css to link them to TinyMCE. This is good if you have more style rules or may use the same style rules in multiple places. It keeps the tinyMCE init() script clean. See content_css for more detail. Here is an example fiddle for content_css implementation.