How to disable the source button in ckeditor 4

I use ckeditor version 4 as a text editor on my website for the user, but I want my site to be safe, so I want to disable the ckeditor source button ... so that the user cannot add any code to my web site.

ckeditor config.js file is empty by default; What is the custom toolbar setting?

This is the file I am using ckeditor in:

 <textarea name="article_content" id="article_content" rows="5" cols="50" style="width:90%; margin-bottom:15px;"></textarea> <script type="text/javascript"> CKEDITOR.replace( 'article_content', { filebrowserBrowseUrl :'<?php echo base_url(); ?>asset/ckeditor/filemanager/browser/default/browser.html?Connector=<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/connector.php', filebrowserImageBrowseUrl : '<?php echo base_url(); ?>asset/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/connector.php', filebrowserFlashBrowseUrl :'<?php echo base_url(); ?>asset/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/connector.php', filebrowserUploadUrl :'<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/upload.php?Type=File', filebrowserImageUploadUrl : '<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/upload.php?Type=Image', filebrowserFlashUploadUrl : '<?php echo base_url(); ?>asset/ckeditor/filemanager/connectors/php/upload.php?Type=Flash' }); </script> 

Does anyone know how to customize a toolbar?

+4
source share
2 answers

Or:

 CKEDITOR.replace( 'article_content', { removePlugins: 'sourcearea', // The rest of options... } ); 

Or:

 CKEDITOR.replace( 'article_content', { removeButtons: 'Source', // The rest of options... } ); 

You can also completely override the toolbar using config.toolbar . For more information, see the Toolbar Customization Guide .

+10
source

You can remove any button from the CKeditor toolbar using the config.removeButton command. Write this line in config.js file

 config.removeButtons = 'Source'; 

if you want to delete multiple items do this

config.removeButtons = 'Anchor, subscript, superscript, strikethrough, Source';

+8
source

Source: https://habr.com/ru/post/1498820/


All Articles