Django Ckeditor的Youtube插件更新了

问题描述 投票:2回答:2

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

我下载了插件到ckeditor插件文件夹,然后编辑了一下。CKEDITOR_CONFIGSsettings.py 显示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
2个回答
4
投票

这只是一个愚蠢的错误。

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

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


0
投票

如果你不想在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')],)

当你下载youtube插件的zip文件从 http:/ckeditor.comaddonyoutube 你必须解压如果在你的项目的静态文件夹中,并添加这个路径到external_plugin_resources,如上面的代码所示。

© www.soinside.com 2019 - 2024. All rights reserved.