我正在使用 FeinCMS (https://github.com/feincms/feincms/) 和支持文件上传的 django-ckeditor (https://github.com/shaunsephton/django-ckeditor)。
我为 RichTextField 创建了一个 FeinCMS 内容类型:
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)
但在 Django 管理中,当我选择“富文本”并按“开始”时,在 Firebug 控制台中出现此错误:
uncaught exception: [CKEDITOR.editor] The instance "id_richcontent_set-__prefix__-text" already exists.
并且ckeditor中的textarea是不可编辑的。
最佳答案
当您尝试使用已分配了 CKEditor 实例的元素(textarea)创建新编辑器时,会发生这种情况。您可以通过探索 CKEDITOR.instances
对象列出您的控制台的事件实例。
我也相信这是解决您问题的方法:CKEditor instance already exists .您最好销毁现有实例或检测它并避免替换其 DOM 元素。
关于javascript - Django-ckeditor 内联错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12449328/