无法在 django-ckeditor 中配置 youtube 插件
Cannot configure youtube plugin in django-ckeditor
我在我的设置和模型中做了以下操作:
settings.py
CKEDITOR_CONFIGS = {
'special': {
'toolbar': 'Special',
'toolbar_Special': [
['Styles', 'Format', 'Bold', 'Italic', 'Underline', 'Strike', 'SpellChecker', 'Undo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Flash', 'Table', 'HorizontalRule'],
['TextColor', 'BGColor'],
['Smiley', 'SpecialChar'], ['Source'],
],
'extraPlugins': 'youtube',
}
}
models.py
class Post(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,null=True,blank=True)
post = RichTextUploadingField(blank=True, null=True,
config_name='special',
external_plugin_resources=[(
'youtube',
'/static/ckeditor/ckeditor/plugins/youtube_2.1.13/youtube/',
'plugin.js',
)],
)
date = models.DateTimeField(auto_now_add=True)
我想在我的 ckeditor 中添加 youtube 插件。我已经从 https://ckeditor.com/cke4/addon/youtube 下载了它。
谁能找出我代码中的问题?
谢谢
你加了吗
config.extraPlugins = 'youtube';
在 config.js 文件中 ?
您是否在 settings.py 配置了您的静态文件?
STATIC_URL = '/static/'
STATIC_ROOT = '/static/'
另请查看此视频,它可能对您有所帮助。
https://www.youtube.com/watch?v=L6y6cn1XUfw
还有
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,
},
}
请确保在项目中使用 大写 Y 这会有所不同。
并勾选
我在我的设置和模型中做了以下操作:
settings.py
CKEDITOR_CONFIGS = {
'special': {
'toolbar': 'Special',
'toolbar_Special': [
['Styles', 'Format', 'Bold', 'Italic', 'Underline', 'Strike', 'SpellChecker', 'Undo'],
['Link', 'Unlink', 'Anchor'],
['Image', 'Flash', 'Table', 'HorizontalRule'],
['TextColor', 'BGColor'],
['Smiley', 'SpecialChar'], ['Source'],
],
'extraPlugins': 'youtube',
}
}
models.py
class Post(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,null=True,blank=True)
post = RichTextUploadingField(blank=True, null=True,
config_name='special',
external_plugin_resources=[(
'youtube',
'/static/ckeditor/ckeditor/plugins/youtube_2.1.13/youtube/',
'plugin.js',
)],
)
date = models.DateTimeField(auto_now_add=True)
我想在我的 ckeditor 中添加 youtube 插件。我已经从 https://ckeditor.com/cke4/addon/youtube 下载了它。
谁能找出我代码中的问题?
谢谢
你加了吗
config.extraPlugins = 'youtube';
在 config.js 文件中 ?
您是否在 settings.py 配置了您的静态文件?
STATIC_URL = '/static/'
STATIC_ROOT = '/static/'
另请查看此视频,它可能对您有所帮助。 https://www.youtube.com/watch?v=L6y6cn1XUfw
还有
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,
},
}
请确保在项目中使用 大写 Y 这会有所不同。
并勾选