how to disable source button in ckeditor 4

16,976

Solution 1

Either by:

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

Or:

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

You can also redefine toolbar completely by using config.toolbar. Read more about it in the Toolbar Customization Guide.

Solution 2

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

config.removeButtons = 'Source';

if you want to remove multiple items do this

config.removeButtons = 'Anchor,Subscript,Superscript,Strikethrough,Source';

Share:
16,976
user2715321
Author by

user2715321

Updated on June 19, 2022

Comments

  • user2715321
    user2715321 almost 2 years

    I am using ckeditor version 4 as text editor in my website for user but I want my website secure, so that's why I want to disable the ckeditor source button... so that user cannot add any kind of code in my website.

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

    This is the file where I am using ckeditor:

    <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 anybody know how to customize the toolbar?

  • David
    David over 9 years
    Thank you. I swear CKEditor is really powerful but their documentation and samples really suck ass. Some of the worst I've ever seen.
  • Reinmar
    Reinmar over 9 years
    We are working on this very hard and in couple of weeks/months the situation will be improved. The problem is the size x complexity of the project - full documentation would have to be enormous and there are simply not enough resources to do it quickly.