admin管理员组

文章数量:1314504

I'm trying to make a minimal implementation of TinyMCE. The only buttons I want are bold, italic, font size, font color, links and undo/redo.

I've trimmed the example from their fiddle demo, and I've been able to remove many of the undesired buttons.

This is what I've reduced the init to, but I don't see what else I could possibly eliminate. Is there a separate config I failed to find? With this, I still get list buttons, super/subscript and remove formatting and insert special character...

tinyMCE.init({
    // General options
    mode: "textareas",
    theme: "advanced",
    plugins: "", //note, i've removed every plugin for demnstration, stll have unwanted buttons

    // Theme options
    theme_advanced_buttons1: "|,bold,italic,|,fontsizeselect,|,forecolor,",
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing: true,
    theme_advanced_text_colors : "FF00FF,FFFF00,000000",
    width: "100%",
    height: "400"
});

I'm trying to make a minimal implementation of TinyMCE. The only buttons I want are bold, italic, font size, font color, links and undo/redo.

I've trimmed the example from their fiddle demo, and I've been able to remove many of the undesired buttons.

This is what I've reduced the init to, but I don't see what else I could possibly eliminate. Is there a separate config I failed to find? With this, I still get list buttons, super/subscript and remove formatting and insert special character...

tinyMCE.init({
    // General options
    mode: "textareas",
    theme: "advanced",
    plugins: "", //note, i've removed every plugin for demnstration, stll have unwanted buttons

    // Theme options
    theme_advanced_buttons1: "|,bold,italic,|,fontsizeselect,|,forecolor,",
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing: true,
    theme_advanced_text_colors : "FF00FF,FFFF00,000000",
    width: "100%",
    height: "400"
});
Share Improve this question edited Feb 26, 2018 at 19:32 user8280225 asked Apr 10, 2012 at 17:35 FlavorScapeFlavorScape 14.3k12 gold badges79 silver badges123 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

Under the theme options, you can enter what you want to have disabled by using theme_advanced_disable. For example to get rid of the subscript and superscript buttons, add the following code:

theme_advanced_disable : "sup,sub"

This ment was addressing TinyMCE 3.X

You need to empty out the second (an possibly third) set of buttons

theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
//etc

TinyMCE 4.

The default toolbar in V4 only seems to have a single set of buttons so the above answer for 3. is a bit misleading. In V4, if you don't specify a toolbar, it'll build one for you.

To set what buttons show up in a toolbar, just specify what items you want.

Single toolbar

toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter

Multiple Toolbars

toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"

OR

toolbar: [
    "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
 ]

Official Docs:

  • Toolbar http://www.tinymce./wiki.php/Configuration:toolbar
  • List of buttons: http://www.tinymce./wiki.php/Controls

You should be able to remove the plugins in the code snippet you mentioned. Just remove what you don't need, and it should adjust.

本文标签: javascriptTinyMCE How to get rid of some buttonsStack Overflow