2

I'm developing an administration component under Joomla 2.5.9 and I have TinyMCE 3.5.4.1 as an editor for my articles. I've set the editor in "simple mode" as I just need few editing options but in addition to those basics I need the "text color". Extended or Advanced modes have to many options which I don't need or I don't want the content manager uses so how can I add just what I want?

Thank you in advance

4

2 回答 2

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)保存,清除缓存并重新加载您的编辑器。而已。

于 2013-06-07T16:32:21.300 回答
0

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

于 2013-06-07T11:29:36.667 回答