Search code examples
djangockeditorsettingstoolbar

Django CKEditor toolbar settings


I have a website on django and everything was excellent before i've installed ckeditor. It works properly, but I can't change the toolbar configuration to "Full". If i write it in settings.py file like this:

CKEDITOR_CONFIGS = {
'Awesome': {
    'toolbar': 'Full',
    'width': 900,
}}

I have an editor block with width of 900px, but toolbar in only 1 row and 13 buttons instead of 3 rows and huge number of buttons. If i change "Full" to "Basic", then my toolbar grows down to 3 buttons.

I know, that I should change settings in config.js file in the ckeditor folder, but no toolbar settings are working. I tried to make a mini-toolbar:

config.toolbar = 
[
    [ 'Source', '-', 'Bold', 'Italic' ]
];

Tried to make a full-toolbar:

    config.toolbar_Full =
[
    { name: 'document',    items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
    { name: 'clipboard',   items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
    { name: 'editing',     items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
    { name: 'forms',       items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
    '/',
    { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
    { name: 'paragraph',   items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
    { name: 'links',       items : [ 'Link','Unlink','Anchor' ] },
    { name: 'insert',      items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak' ] },
    '/',
    { name: 'styles',      items : [ 'Styles','Format','Font','FontSize' ] },
    { name: 'colors',      items : [ 'TextColor','BGColor' ] },
    { name: 'tools',       items : [ 'Maximize', 'ShowBlocks','-','About' ] }
];

I tried to delete or change ckeditor's settings in settings.py file of my project, after every change I have restarted the server, but nothing happened =(

The config.js file is working, a can add a button that hides the toolbar

config.toolbarCanCollapse = true;

And it works great =)

What shall I do to make a really full toolbar like this? My brain is blowing up, so i'll be really happy if someone help me! And sorry for my awful english...


Solution

  • heres a snippet from my django ckeditor toolbar settings. Its not full but you should be able to add to it to get what you want.

     'toolbar': [["Format", "Bold", "Italic", "Underline", "Strike", "SpellChecker"],
                    ['NumberedList', 'BulletedList', "Indent", "Outdent", 'JustifyLeft', 'JustifyCenter',
                     'JustifyRight', 'JustifyBlock'],
                    ["Image", "Table", "Link", "Unlink", "Anchor", "SectionLink", "Subscript", "Superscript"], ['Undo', 'Redo'], ["Source"],
                    ["Maximize"]],
    

    On a separate note, id recommend using the native javascript ckeditor if possible in your django propject. Ive been using the django version for a while now and its proving top be a serious headache for your reason mentioned above among other reasons.