14

I want to hide the button toolbar in tinymce.

How to do that?

hc_dev
  • 8,389
  • 1
  • 26
  • 38
Mercer
  • 9,736
  • 30
  • 105
  • 170

9 Answers9

28

Using tinyMCE 4 you can set the following in the tinymce init:

toolbar: false

Here is a full blown example of the init if you want a clean editor with no options:

<script type="text/javascript">
    tinymce.init({
        menubar: false,
        statusbar: false,
        toolbar: false
    });
</script>
JasonH
  • 1,221
  • 2
  • 19
  • 19
5

There is a plugin that will do this either from a link outside of the editor or from the toolbar itself.

http://www.neele.name/pdw_toggle_toolbars/

Download and extract to your /tiny_mce/plugins/ folder

Then add:

 $('textarea.tinymce').tinymce({
    plugins : "pdw,your other plugins ... "
    // All of your other configurations
    theme_advanced_buttons1 : "pdw_toggle,bold,italic,underline and the rest...
    // Add PDW
    pdw_toggle_on : 1,
    pdw_toggle_toolbars : "2,3,4"
 }
ablemike
  • 3,384
  • 3
  • 22
  • 21
3

If ed is a reference to your tinymce editor instance, you may use the following jQuery snippet to hide the toolbar:

$('#'+ed.id+'_toolbargroup').parent().css('display','none');

use

$('#'+ed.id+'_toolbargroup').parent().css('display','block')

to get it back;

nanoamp
  • 118
  • 1
  • 9
Thariama
  • 50,002
  • 13
  • 138
  • 166
2

A quick and dirty fix would be to simply hide it through CSS

#my_textarea_id_tbl tr.mceFirst { display:none; }

If its just for visual reasons this might be enough.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
Hampus Ahlgren
  • 519
  • 1
  • 5
  • 15
2

In tinymce4, inline mode, I use simply:

tinymce.EditorManager.activeEditor.getElement().blur();
1
$(".mceToolbar:eq(1)").hide();

will work for you

replace eq(1) with your button container toolbar e.g. eq(2),eq(3),eq(4)..

Vishal Sharma
  • 2,773
  • 2
  • 24
  • 36
1

if you do an inspection on you tree DOM , you will find :

<a id="tinyelement_external_close" href="javascript:;" class="mceExternalClose"></a>

So add Jquery instruction to have inner HTML as following

$('a#tinyelement_external_close').html('Close')

You will have :

<a id="tinyelement_external_close" href="javascript:;" class="mceExternalClose">Close</a>

Refresh you page you find close link at top-right of toolbar. Click on it . Toolbar become hidden .

Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
1

simple, use theme: 'advanced', theme_advanced_statusbar_location : 'none',

marcomoser
  • 691
  • 1
  • 4
  • 4
1

we can hide the cut , copy , paste in menu :

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  menu: {
    file: {title: 'File', items: 'newdocument'},
    edit: {title: 'Edit', items: 'undo redo | selectall'}, // | cut copy paste pastetext we can remove it because it won't work
    insert: {title: 'Insert', items: 'link media | template hr'},
    view: {title: 'View', items: 'visualaid'},
    format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
    table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
    tools: {title: 'Tools', items: 'spellchecker code'}
  }
});