Django-ckeditor inline error
-
02-07-2021 - |
Question
I'm using FeinCMS (https://github.com/feincms/feincms/) and django-ckeditor with file upload support (https://github.com/shaunsephton/django-ckeditor).
I create a FeinCMS content type for RichTextField:
class RichContent(models.Model):
text = RichTextField(_('text'))
class Meta:
abstract = True
verbose_name = _('Rich Text')
verbose_name_plural =_('Rich Text')
def render(self, **kwargs):
context_instance = kwargs.get('context_instance')
return render_to_string('content/page/rich_content.html', {
'page': self,
}, context_instance=context_instance)
But in Django admin, when i select 'Rich Text' and press 'Go', get this error in firebug console:
uncaught exception: [CKEDITOR.editor] The instance "id_richcontent_set-__prefix__-text" already exists.
And textarea in ckeditor do not editable.
La solution
This is what happens when you try to create a new editor by using an element (textarea) which has already been assigned a CKEditor instance. You can list active instances with your console by exploring the CKEDITOR.instances
object.
I also believe this is the one which solves your problem: CKEditor instance already exists . You should better destroy the existing instance or detect it and avoid replacing its DOM element.