admin管理员组

文章数量:1323715

Is there a way in TinyMCE to disable the "edit html" button? I'm overwhelmed by the config options and can't seem to find it. I noticed users can use that to place javascript in their field which I do not want. By the way I am using this gem -

Is there a way in TinyMCE to disable the "edit html" button? I'm overwhelmed by the config options and can't seem to find it. I noticed users can use that to place javascript in their field which I do not want. By the way I am using this gem - https://github./spohlenz/tinymce-rails

Share Improve this question asked Oct 10, 2012 at 16:21 HelloWorldHelloWorld 4,3498 gold badges38 silver badges60 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

Use theme_advanced_disable: "code" when you initialise the tinymce object.

EDIT - didn't see you were using the rails version, sorry. This will remove the button in plain javascript.

You might try:

HtmlEditorConfig::get('cms')->removeButtons('advcode');

or

theme_advanced_disable: "code"

I've made a fiddle here: http://fiddle.tinymce./cmcaab

If you're trying to have it set by the gem rather than just writing the javascript, you just need to edit the config/tinymce.yml file. So the yml file should have a line that says

theme_advanced_disable: code

OR (from README on that gem)

Custom options can be passed to tinymce to override the global options specified in config/tinymce.yml:

So I think you can just add a :theme_advanced_disable => ["code"] when calling the timeMCE (though I'm not 100% sure that's the correct syntax):

<%= tinymce :theme => "simple", :theme_advanced_disable => ["code"], :plugins => ["inlinepopups", "paste"] %>

You can read more about this here:

Do you mean the "edit html source" button? You could just not put it in the toolbar, under the theme_advanced_buttons options all you have to do is omit it.

The button is called code

本文标签: javascriptTinyMCE disable html edit buttonStack Overflow