2014-01-12 110 views
1

我想爲ckeditor使用自動增長插件。由於我是django和ckeditor的新手,我在配置時遇到了麻煩。我的設置無法識別。以下是一系列步驟。我已經看到必須重新構建ckeditor的提法。我不知道這是否需要。平臺:Ubuntu,django-cms 3 beta,djangocms-text-ckeditor(在virtualenv中安裝使用過的pip),python 2.7。用djangocms-text-ckeditor配置自動增長插件

我不確切地知道我需要做什麼,但我改變了以下方面。 S130。在項目的settings.py,加入

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

S2。在../site-packages/django_text_ckeditor/static/ckeditor/config.js,編輯

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。增加了自動增長的插件文件夾

「../site-packages/django_text_ckeditor/static/ckeditor/plugins/autogrow」

S4。的

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

'extraPlugins' 修改線45: 'cmsplugins,自動增長'

S5。增加了額外的語句

線58後 「../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'); 

不知道還能做什麼?思考?建議嗎?不需要https://github.com/django-ckeditor/django-ckeditor

你的步驟S2和S4和S5:使用標準的Django的CKEditor從這裏

回答

1

我'。它不會修改ckeditor的來源。只需從http://ckeditor.com/addon/autogrow下載自動增長插件並使用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'] 
     ], 
    } 
}