Search code examples
javascriptphphtmlckeditor

Ckeditor remove specific plugins?


I am using CKeditor on 2 pages. On 1st Page I need all plugins while on 2nd page I only need few of them. I try to find solution and I got this:

config.removePlugins = 'elementspath,save,font,templates,';

in config.js.Now if I add this in config.js it disable attributes globally rather than on a specific page. How Can I disable plugins on a specific page. I am doing this to make textarea as ckeditor.

Javascript:

<script>
var url = "<?php echo base_url(); ?>";

CKEDITOR.replace( 'template_body',{
        //extraPlugins: 'imageuploader'

      } );

</script>

HTML:

<div class="elementbox">
                <label class="form-label">Body<span class="required">*</span></label>
                <div class="controls">
                    <textarea name="template_body" id="template_body" rows="10" cols="80"></textarea>
                </div>
            </div>

Edit- I even tried these as per all comments but not working.

<script>
var url = "<?php echo base_url(); ?>";

CKEDITOR.replace( 'template_body',{
        //extraPlugins: 'imageuploader'

      } );
CKEDITOR.editorConfig = function( config ) {
    config.removePlugins = 'elementspath,save,font';
    };
</script>

Solution

  • After alot researching I have found a solution for myself. We can load only specific toolbar as per our need. As On 2nd Page I need my custom toolbar so I can do this in

    config.js

    config.toolbar_Basic =
        [
            ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']
        ];
    

    Where I am loading the ckeditor

    HTML

    CKEDITOR.replace( 'template_body',{
            //extraPlugins: 'imageuploader'
    
        toolbar: 'Basic'
          } );
    

    That Will Load only specific toolbar only