默认情况下,如何在TinyMCE中选择“文本对齐”切换按钮?

时间:2018-11-30 12:28:19

标签: javascript extjs configuration tinymce togglebutton

我的应用程序是使用Ext.js编写的,并且使用TinyMCE。 TinyMCE编辑器中的工具栏提供了文本对齐选项:左对齐,居中,右对齐和对齐。我希望在加载包含编辑器的屏幕时默认选择“ justify”选项。我看着TinyMCE和Ext.js的文档都没有用。

这是我的TinyMCE的配置代码:

Ext.define('Xxx.config.TinyMceConfig',{
    singleton : true,
    alternateClassName : ['TinyMceConfig'],
    config:{
        plugins: [
            "lists link charmap searchreplace code fullscreen table paste ice"
        ],
        language : "fr_FR",
        docs_language : "fr_FR",
        visual : true,
        cleanup_on_startup : false,
        cleanup : true,
        gecko_spellcheck : true,
        remove_linebreaks : false,
        encoding : "xml",
        entity_encoding : "raw",
        toolbar1 : "fullscreen | undo redo selectall | bold italic underline  alignleft aligncenter alignright alignjustify  | pastetext pasteword pasteEditor",
        toolbar2 : "searchreplace | subscript superscript charmap | unlink removeformat | visualaid table | cleanup code ice_smartquotes",
        toolbar3 : "bullist numlist row_props cell_props | row_before row_after delete_row | col_before col_after delete_col | ice_togglechanges ice_toggleshowchanges iceacceptall icerejectall iceaccept icereject",

        inline_styles : false,
        paste_as_text :true,
        paste_auto_cleanup_on_paste: true,
        paste_text_use_dialog: true,
        paste_retain_style_properties: "margin, border, border-width, border-style, bgcolor, background, border-color, ul, li, ol, page-break-before, " +
            " page-break-after, border-collapse, padding, width, height, font-size, font-weight, font-family, text-align, text-decoration, float, " +
            "display, line-height, align",
        paste_convert_headers_to_strong : true,
        paste_convert_word_fake_lists: false,
        ice: {
            isForceTracking: false,
            isTracking: false,
            user: { name: 'Utilisateur inconnu', id: 1}
        },

        menubar:false,
        statusbar: false,
        elementpath: false,
        toolbar_items_size: 'small'
    },

    constructor: function(config) {
        this.initConfig(config);
    }
});

1 个答案:

答案 0 :(得分:1)

请参见以下示例TinyMCE Fiddle,了解如何使编辑器从选择对齐对齐开始:

http://fiddle.tinymce.com/I4gaab/2