【问题标题】:Youtube Plugin for Django Ckeditor UpdatedDjango Ckeditor 的 Youtube 插件已更新
【发布时间】:2014-09-26 04:28:01
【问题描述】:

我正在使用 Django-ckeditor-updated 构建一个 CMS,我正在尝试使用 Ckeditor youtube 插件 (http://ckeditor.com/addon/youtube),但它没有出现在工具栏中。

我已将插件下载到 ckeditor 插件文件夹,然后在 settings.py 中编辑了 CKEDITOR_CONFIGS 以显示 youtube 插件,但它无法正常工作。有什么想法吗?

CKEDITOR_CONFIGS = {
'default': {
    'toolbar': 'CMS',
    'toolbar_CMS': [
        {
            'name': 'basicstyles',
            'groups': ['basicstyles', 'cleanup'],
            'items': ['Bold', 'Italic', 'Underline', '-', 'RemoveFormat']
        },
        {
            'name': 'paragraph',
            'groups': ['list', 'indent', 'blocks'],
            'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote']
        },
        {
            'name': 'links',
            'items': ['Link', 'Unlink']
        },
        {
            'name': 'insert',
            'items': ['Image', 'HorizontalRule', 'Table', 'Iframe', ]
        },
        {
            'name': 'colors',
            'items': ['TextColor', 'BGColor']
        },
        {
            'name': 'youtube',
            'items': ['youtube',]
        }
    ],
    'height': 400,
    'width': '100%',
    'allowedContent': True,
    'uiColor': '#f0f0f0',
    'extraPlugins': 'link,iframe,colorbutton,autogrow,youtube',
    'autoGrow_maxHeight': 800,
    'autoGrow_minHeight': 400,
    'removePlugins': 'resize',
    'removeButtons': None,
    'contentsCss': ['/static/css/news_show.css', '/static/css/cke.css'],
},
}

【问题讨论】:

    标签: django python-2.7 youtube ckeditor django-ckeditor


    【解决方案1】:

    这只是一个愚蠢的错误。

        {
            'name': 'youtube',
            'items': ['Youtube',]
        }
    

    youtube 项目中的 y 必须为大写。

    【讨论】:

      【解决方案2】:

      如果你不想声明到 settings.py 文件中,你也可以将它添加到 models.py 文件中。参见下面的代码:-

      class Post(models.Model): 
      
          content = RichTextUploadingField(blank=True, null=True, extra_plugins= 
          ['codesnippet','youtube',], external_plugin_resources= 
          [('youtube','/static/blog/ckeditor_plugin/youtube/youtube/','plugin.js')],)
      

      当您从http://ckeditor.com/addon/youtube 下载 youtube 插件的 zip 文件时,如果在项目的静态文件夹中,则必须解压缩。并将此路径添加到 external_plugin_resources,如上面的代码所示。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-06-25
        • 2019-08-03
        • 2015-01-01
        • 1970-01-01
        • 2015-11-26
        • 2016-04-05
        • 2016-07-27
        • 2015-01-12
        相关资源
        最近更新 更多