开发者

TinyMCE plugin not showing

My plugin doesnt show up in tinymce even though I can see it getting called. Anyone see what 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:/开发者_StackOverflow/blah.com',
            infourl: 'http://blah.com',
            version: "1.0"
        };
    }
});

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

Thanks


Assuming that you've included it correctly in both the plugins element and a *theme_advanced_buttons* config item then I suspect the problem is a JavaScript error in your plugin.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜