代码之家  ›  专栏  ›  技术社区  ›  Devesh Kumar

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

  •  4
  • Devesh Kumar  · 技术社区  · 12 年前

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

    这是代码,但不起作用:

    tinymce.init({
                    selector: 'textarea#editor',
                    menubar: false,
                    statusbar: false,
                    resize: false,
                    height: textEditHeight,
                    theme_modern_toolbar_location : "bottom",
    });
    
    5 回复  |  直到 12 年前
        1
  •  4
  •   Andy    11 年前

    我知道这是一篇旧帖子,但我想我会分享我的解决方案。

    我为“init”事件添加了一个事件处理程序,然后使用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
  •  4
  •   Aditya Agarwal    9 年前

    我已经找到了一种方法,使用纯CSS。只需将此代码添加到自定义css文件或html中的样式标记中即可。

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

    它所做的是颠倒div的排列方向,即从下到上 。唯一的缺点是flex是一个现代的CSS属性,因此在旧的浏览器中不受支持

        3
  •  3
  •   kdureidy    12 年前

    根据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
  •  1
  •   Devesh Kumar    12 年前

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

        5
  •  0
  •   Adeel Kirti Nariya    7 年前

    在自定义css文件的css代码底部插入

    .mce-top-part{
        position:absolute;
        bottom:0
    }