工具栏在TinyMCE中右侧对齐

时间:2017-12-14 17:12:15

标签: javascript css tinymce

我的toolbar1与右边对齐,但我不想要它。如何删除此对齐?

我的JS:

    tinymce.init({
        selector: '#mytextarea',
        theme: 'modern',
        skin: 'lightgray',
        menubar: false,
        branding: false,
        plugins: [
            "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
            "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
            "table contextmenu directionality emoticons template textcolor paste fullpage textcolor colorpicker textpattern",
            "pagebreak"
        ],

        setup: function (editor) {

        },

        toolbar1: "newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | styleselect formatselect fontselect fontsizeselect",
        toolbar2: "cut copy paste | searchreplace | bullist numlist | outdent indent blockquote | undo redo | link unlink anchor | insertdatetime preview | forecolor backcolor",
        toolbar3: "table | hr removeformat | subscript superscript | charmap | print fullscreen | ltr rtl | spellchecker | visualchars visualblocks | pagebreak",
        init_instance_callback: "renderEditor",
        height: "300"
});

以下是它的显示方式: enter image description here

有人知道为什么too​​lbar1与右边对齐吗?

由于

1 个答案:

答案 0 :(得分:0)

将下面的样式放入 list.css 文件

.mce-content-body ol[align="center"],
.mce-content-body ol li[align="center"],
.mce-content-body ul[align="center"],
.mce-content-body ul li[align="center"] {
    text-align: center;
}
.mce-content-body ol[align="left"],
.mce-content-body ol li[align="left"],
.mce-content-body ul[align="left"],
.mce-content-body ul li[align="left"] {
    text-align: left;
}
.mce-content-body ol[align="right"],
.mce-content-body ol li[align="right"],
.mce-content-body ul[align="right"],
.mce-content-body ul li[align="right"] {
    text-align: right;
}

然后在tinymce.init()函数上使用

tinymce.init({
    selector: '#tinymce-textarea',
    content_css: ['list.css']
});