2014-01-12 112 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'] 
     ], 
    } 
}