TinyMCE Hide the bar

馋奶兔 提交于 2019-12-22 03:19:36

问题


I use tinymce and i want to hide the button toolbar. Is there a way to do that?


回答1:


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>



回答2:


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"
 }



回答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;




回答4:


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.




回答5:


In tinymce4, inline mode, I use simply:

tinymce.EditorManager.activeEditor.getElement().blur();



回答6:


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




回答7:


$(".mceToolbar:eq(1)").hide();

will work for you

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




回答8:


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 .




回答9:


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'}
  }
});


来源:https://stackoverflow.com/questions/2628187/tinymce-hide-the-bar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!