简体   繁体   中英

Configuring autogrow plugin with djangocms-text-ckeditor

I am trying to use the autogrow plugin for ckeditor. As I am new to django and ckeditor I am having trouble with configuration. My settings are not being recognized. Below is a list of steps. I have seen reference to having to build ckeditor over again. I do not know if this is needed.

Platform: Ubuntu, django-cms 3 beta, djangocms-text-ckeditor (installed used pip in virtualenv), python 2.7.

I do not know exactly what I need to do, but I changed the following anyway.

S1. In project's settings.py, added

 CKEDITOR_SETTINGS = getattr(settings, 'CKEDITOR_SETTINGS', { 'config.autoGrow_onStartup': True, 'config.autoGrow_minHeight': 200, 'config.autoGrow_maxHeight': 400, }) 

S2. In ../site-packages/django_text_ckeditor/static/ckeditor/config.js, edited

 CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; config.autoGrow_onStartup = true; config.autoGrow_minHeight = 2000; config.autoGrow_maxHeight = 4000; }; 

S3. Added the autogrow plugin folder to

"../site-packages/django_text_ckeditor/static/ckeditor/plugins/autogrow"

S4. Modified line 45 of

 "../site-packages/django_text_ckeditor/static/js/cms.ckeditor.js" 

'extraPlugins': 'cmsplugins, autogrow'

S5. Added an extra statement after line 58 of

"../site-packages/django_text_ckeditor/static/js/cms.ckeditor.js"

 // this is line 58 CKEDITOR.plugins.addExternal('cmsplugins', settings.static_url + 'ckeditor_plugins/cmsplugins/'); // this is the added line CKEDITOR.plugins.addExternal('autogrow', settings.static_url + 'ckeditor/plugins/autogrow'); 

Do not know what else to do? Thoughts? Advice?

I'am using standard django-ckeditor from here: https://github.com/django-ckeditor/django-ckeditor

Your Step S2 and S4 and S5 are not needed. It makes no sens to modify the source of ckeditor. Just download the autogrow plugin from http://ckeditor.com/addon/autogrow and config with settings.py:

CKEDITOR_CONFIGS = {
    'default': {
        'autoGrow_onStartup': True,
        'autoGrow_minHeight': 100,
        'autoGrow_maxHeight': 650,
        'extraPlugins': 'autogrow',
            'toolbar': 'Custom',
            'toolbar_Custom': [
            ['Bold', 'Italic', 'Underline'],
            ['Format'],
            #['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
            ['Link', 'Unlink'],
            ['RemoveFormat', 'Source']
        ],
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM