在Joomla中为TinyMCE编辑器添加选项

时间:2013-06-07 10:14:52

标签: joomla tinymce

我正在Joomla 2.5.9下开发一个管理组件,我有TinyMCE 3.5.4.1作为我的文章的编辑器。 我将编辑器设置为“简单模式”,因为我只需要很少的编辑选项,但除了这些基础知识外,我还需要“文本颜色”。 扩展或高级模式有许多我不需要的选项,或者我不希望内容管理器使用,所以如何才能添加我想要的内容?

提前谢谢

2 个答案:

答案 0 :(得分:0)

猜猜,这对您有所帮助:http://forum.joomla.org/viewtopic.php?p=1031220

答案 1 :(得分:0)

好的我明白了! 我将尝试通过以下步骤解释我的“脏但有​​效”的解决方案:

1)激活TinyMCE的“扩展模式”

2)转到%YOUR_JOOMLA_INSTALLATION_PATH%\ media \ editors \ tinymce \ jscripts \ tiny_mce \ themes \ advanced

3)打开文件editor_template.js并转到第107行(对于版本3.5.4.1),您将在其中找到此代码:

    tinymce.create('tinymce.themes.AdvancedTheme'...

4)在几行后你会找到“控件”对象的定义

    controls : {
        bold : ['bold_desc', 'Bold'],
        italic : ['italic_desc', 'Italic'],
        underline : ['underline_desc', 'Underline'],
        strikethrough : ['striketrough_desc', 'Strikethrough'],
        justifyleft : ['justifyleft_desc', 'JustifyLeft'],
        justifycenter : ['justifycenter_desc', 'JustifyCenter'],
        justifyright : ['justifyright_desc', 'JustifyRight'],
        justifyfull : ['justifyfull_desc', 'JustifyFull'],
        bullist : ['bullist_desc', 'InsertUnorderedList'],
        numlist : ['numlist_desc', 'InsertOrderedList'],
        outdent : ['outdent_desc', 'Outdent'],
        indent : ['indent_desc', 'Indent'],
        cut : ['cut_desc', 'Cut'],
        copy : ['copy_desc', 'Copy'],
        paste : ['paste_desc', 'Paste'],
        undo : ['undo_desc', 'Undo'],
        redo : ['redo_desc', 'Redo'],
        link : ['link_desc', 'mceLink'],
        unlink : ['unlink_desc', 'unlink'],
        image : ['image_desc', 'mceImage'],
        cleanup : ['cleanup_desc', 'mceCleanup'],
        help : ['help_desc', 'mceHelp'],
        code : ['code_desc', 'mceCodeEditor'],
        hr : ['hr_desc', 'InsertHorizontalRule'],
        removeformat : ['removeformat_desc', 'RemoveFormat'],
        sub : ['sub_desc', 'subscript'],
        sup : ['sup_desc', 'superscript'],
        forecolor : ['forecolor_desc', 'ForeColor'],
        forecolorpicker : ['forecolor_desc', 'mceForeColor'],
        backcolor : ['backcolor_desc', 'HiliteColor'],
        backcolorpicker : ['backcolor_desc', 'mceBackColor'],
        charmap : ['charmap_desc', 'mceCharMap'],
        visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
        anchor : ['anchor_desc', 'mceInsertAnchor'],
        newdocument : ['newdocument_desc', 'mceNewDocument'],
        blockquote : ['blockquote_desc', 'mceBlockQuote']
    },

在这里你可以只评论你不需要的控件。

5)之后你会找到stateControls对象,在那里你将评论之前注释的相同控件

    stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote']

6)至少你会找到工具栏的定义。在这里,您可以添加/删除您需要/不需要的按钮,并最终将它们移动到您想要的位置。

    // Setup default buttons
        if (!s.theme_advanced_buttons1) {
            s = extend({
                theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,forecolor,backcolor",
                theme_advanced_buttons2 : "sub,sup",
                theme_advanced_buttons3 : "anchor"
            }, s);
        }

7)保存,清除缓存并重新加载编辑器。就是这样。