TinyMCE Plugin Not Displaying

My plugin does not appear in tinymce, although I can see that it is called. Does anyone see Ive missed?

(function () {
tinymce.PluginManager.requireLangPack('prettifier');
tinymce.create('tinymce.plugins.PrettifierPlugin', {
    init: function (ed, url) {
        debugger;
        //            ed.addCommand('mcePrettifier', function () {
        //                ed.windowManager.open({
        //                    file: url + '/dialog.htm',
        //                    width: 320 + ed.getLang('prettifier.delta_width', 0),
        //                    height: 120 + ed.getLang('prettifier.delta_height', 0),
        //                    inline: 1
        //                });
        //            });

        //            ed.addButton('prettifier', {
        //                title: 'prettifier.desc',
        //                cmd: 'mcePrettifier',
        //                image: url + '/img/prettifier.gif'
        //            });

        ed.addButton('prettifier', {
            title: 'prettifier.desc',
            cmd: 'mcePrettifier',
            image: url + '/img/prettifier.gif',
            onclick: function () {
                ed.focus(),
                ed.selection.setContent('<pre class="prettifier">' + ed.selection.getContent() + '</pre>');
            }
        });


    },

    createControl: function (n, cm) {
        return null;
    },

    getInfo: function () {
        return {
            longname: 'Code Prettifier plugin',
            author: 'blah',
            authorurl: 'http://blah.com',
            infourl: 'http://blah.com',
            version: "1.0"
        };
    }
});

debugger;
tinymce.PluginManager.add('prettifier', tinymce.plugins.PrettifierPlugin);
})();

thank

+3
source share
1 answer

Assuming you correctly included it in both the plugins element and the * theme_advanced_buttons * configuration element, I suspect that the problem is due to a JavaScript error in your plugin.

In the code you included, you have a comma instead of a comma at the end of ed.focus () in the onclick button for the button.

+5
source

All Articles