TinyMCE: How to display all toolbars on a single row?

后端 未结 4 900
小鲜肉
小鲜肉 2020-12-19 08:15

This question is basically reverse of Is there a way to wrap the toolbar buttons to the next row in TinyMCE if the width of the editor is too small?

I have a TinyMCE

4条回答
  •  抹茶落季
    2020-12-19 08:58

    This won't work using css only because the different rows have an own table element. What you can do is to check before tinymce initialization how wide the users screen is. Depending on this value you may set the theme_advanced_buttons1 and theme_advanced_buttons2 etc...

    Example:

    var width = screen.width;
    
    tinyMCE.init({
    mode: 'exact',
        ....
    
        theme_advanced_buttons1 : width < 1024 ? "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter" : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : width < 1024 ? "justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect" : "",
        ...
    });
    

提交回复
热议问题