I am struggling adding plugins inside HTMLField as djangocms-text-ckeditor in the latest version Django-Cms 4.1.0rc4 add fileimage plugin/button in the toolbar of it.
In my models.py
class PortfolioItem(CMSPlugin):
# Attributes - Mandatory
title = models.CharField(_('title'),
max_length=200,
blank=False)
content = HTMLField()
In the settings.py
CMS_PLACEHOLDER_CONF = {
'content': {
'name' : _('Content'),
'plugins': ['TextPlugin', 'LinkPlugin', 'FilerImage'],
'default_plugins':[
{
'plugin_type':'TextPlugin',
'values':{
'body':'<p>Great websites : %(_tag_child_1)s and %(_tag_child_2)s</p>'
},
'children':[
{
'plugin_type':'LinkPlugin',
'values':{
'name':'django',
'url':'https://www.djangoproject.com/'
},
},
{
'plugin_type':'FilerImage',
'values':{
'name':'django-cms',
'url':'https://www.django-cms.org'
},
},
]
},
]
}
}
CKEDITOR_SETTINGS = {
'language': '{{ language }}',
'toolbar': 'CMS',
'toolbar_HTMLField': [
['Undo', 'Redo'],
['cmsplugins', '-', 'ShowBlocks'],
['Format', 'Styles'],
],
'skin': 'moono-lisa',
}
I can not get the list of plugins and fileimage button does not show up. How do I get the plugins inside nested editor?
ps: in the console i am getting
bundle-9f0bbac8ec.cms.ckeditor.min.js:25 [CKEDITOR] Error code: editor-plugin-deprecated. {plugin: 'flash'}
You can't add plugins in an HTML field.
But what you can do is have child plugins, so that
PortfolioItemcan contain other plugins.The main option on your plugin configuration is
allow_childrenwhich will allow you to nest other plugins within an instance of your plugin.You can also restrict the plugins which can be nested, using
child_classes. Similarly, a plugin can haveparent_classesdefined to only allow it to be a child of those given parent plugin classes.