开发者

How to customize tinyMCE built-in buttons like -silverstripe- CMS

when I had a look on http://demo.silverstripe.com/admin/ [user-name:admin ,password:admin]

I noticed that they have overridden the insert image button and also the insert flash button


they have replaced it with their own widget.

The Question is What is the easiest way achieve this or the best guide ?

note : I'm not using sliverstripe or any ready made开发者_StackOverflow CMS


Adding your own buttons is quite well described at the TinyMCE web: http://tinymce.moxiecode.com/tryit/custom_toolbar_button.php

Pasted from site:

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    theme_advanced_buttons1 : "mybutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    plugins : 'inlinepopups',
    setup : function(ed) {
        // Add a custom button
        ed.addButton('mybutton', {
            title : 'My button',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('Hello world!');
            }
        });
    }
});

Just change this as you please.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜