【问题标题】:Configuring autogrow plugin with djangocms-text-ckeditor使用 djangocms-text-ckeditor 配置自动增长插件
【发布时间】:2014-01-31 10:18:08
【问题描述】:

我正在尝试使用 ckeditor 的自动增长插件。由于我是 django 和 ckeditor 的新手,所以我在配置时遇到了问题。我的设置未被识别。以下是步骤列表。我已经看到必须重新构建 ckeditor 的参考。不知道有没有必要。

平台:Ubuntu、django-cms 3 beta、djangocms-text-ckeditor(安装在 virtualenv 中使用的 pip)、python 2.7。

我不确切知道我需要做什么,但我还是更改了以下内容。

S1。在项目的 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。将 autogrow 插件文件夹添加到

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

S4。修改了

的第 45 行
"../site-packages/django_text_ckeditor/static/js/cms.ckeditor.js"

'extraPlugins': 'cmsplugins, autogrow'

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');

不知道还能做什么?想法?建议?

【问题讨论】:

    标签: django-cms django-ckeditor


    【解决方案1】:

    我在这里使用标准的 django-ckeditor:https://github.com/django-ckeditor/django-ckeditor

    不需要您的步骤 S2 和 S4 和 S5。修改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']
            ],
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-10-21
      • 2013-07-05
      • 1970-01-01
      • 1970-01-01
      • 2017-04-16
      • 2015-01-14
      • 2014-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多