TinyMCE的:在编辑器底部的工具栏位置

问题描述 投票:4回答:5

我使用TinyMCE的4现代主题。我想在编辑器底部设置工具栏的位置(就像在状态栏)

下面是代码,但它不工作:

tinymce.init({
                selector: 'textarea#editor',
                menubar: false,
                statusbar: false,
                resize: false,
                height: textEditHeight,
                theme_modern_toolbar_location : "bottom",
});
javascript tinymce tinymce-4
5个回答
3
投票

基于TinyMCE的文件上,你只能使用theme_modern_toolbar_location:“底”

当您使用高级的主题。

theme : "advanced",

完整的示例:

<script type="text/javascript">
// O2k7 skin
tinyMCE.init({
        // General options
        mode : "exact",
        elements : "elm1",
        theme : "advanced",
        skin : "o2k7",
        plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
        theme_advanced_toolbar_location : "bottom"
});

</script>

<form method="post" action="dump.php">
        <textarea id="elm1" name="elm1" style="width:100%">
        </textarea>


</form>

4
投票

我知道这是一个古老的职位,但我想我会分享我的解决方案。

我添加事件处理程序“初始化”事件,然后使用jQuery更改的工具栏和编辑的div的顺序。

tinyMCE.init({
...

    setup: function (ed) {
      ed.on('init', function (evt) {
          var toolbar = $(evt.target.editorContainer)
                            .find('>.mce-container-body >.mce-toolbar-grp');
          var editor = $(evt.target.editorContainer)
                            .find('>.mce-container-body >.mce-edit-area');

          // switch the order of the elements
          toolbar.detach().insertAfter(editor);
      });
}

2
投票

我已经想出了一个办法,用纯CSS。只需在您的自定义CSS文件或HTML中的样式标签中添加此代码。

#mceu_5-body{
   display: flex;
   flex-direction: column-reverse;
}

它的作用是反向,其中所述的div是从底部到顶部,即布置方向。唯一的缺点是,flex是一个现代化的CSS属性,因此在旧的浏览器不支持


1
投票

在他们的博客中的一个,他们说,他们已经删除advanced_theme。所以,如果我们想在TinyMCE的底部使用的工具栏,我们必须建立一个新的皮肤。


0
投票

下面插入您的自定义CSS文件的CSS代码底部

.mce-top-part{
    position:absolute;
    bottom:0
}
© www.soinside.com 2019 - 2024. All rights reserved.