Latest news
Home » javaScript » Restrict ckeditor to basic toolbar

Restrict ckeditor to basic toolbar

We can use javascript or jquery to apply ckeditor configuration

<textarea id=”textarea” cols=”15″ name=”txtdesc” rows=”5″></textarea>


Must be included ckeditor.js

Take the instance of ckeditor and replace with new configuration

<script type=”text/javascript”>

var editor = CKEDITOR.instances[‘txtdesc‘];
if (editor) { editor.destroy(true);
var editorContent =CKEDITOR.replace(‘txtdesc‘, {
toolbar: [
{ name: ‘document’, items: [ ‘Source’, ‘-‘, ‘NewPage’, ‘Preview’, ‘-‘, ‘Templates’ ] }, // Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
[ ‘Cut’, ‘Copy’, ‘Paste’, ‘PasteText’, ‘PasteFromWord’, ‘-‘, ‘Undo’, ‘Redo’,’SelectAll’, ‘RemoveFormat’ ], // Defines toolbar group without name.

‘/’, // Line break – next group will be placed in new line.
{ name: ‘basicstyles’, items: [ ‘Replace’,’Bold’,’TextColor’, ‘Italic’,’JustifyLeft’,’JustifyCenter’,’JustifyRight’,’JustifyBlock’,’Font’,’-‘,’Form’,’Checkbox’,’Radio’,’TextField’,’Textarea’,’Select’, ‘NumberedList’, ‘BulletedList’, ‘-‘, ‘Link’, ‘Unlink’,’SpecialChar’ ] }
] });

Leave a Reply


Check Also

How to print Codeigniter upload error

if you want to display errors on upload functionality in codeigniter. Use the following function ...