1

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 管理者で、「Rich Text」を選択して「Go」を押すと、firebug コンソールで次のエラーが発生します。

uncaught exception: [CKEDITOR.editor] The instance "id_richcontent_set-__prefix__-text" already exists.

また、ckeditorのテキストエリアは編集できません。

4

1 に答える 1

2

これは、既に CKEditor インスタンスが割り当てられている要素 (テキストエリア) を使用して新しいエディターを作成しようとすると発生します。オブジェクトを探索することにより、コンソールでアクティブなインスタンスを一覧表示できCKEDITOR.instancesます。

私はまた、これがあなたの問題を解決するものだと信じています: CKEditor instance already exists . 既存のインスタンスを破棄するか、それを検出して、その DOM 要素を置き換えないようにすることをお勧めします。

于 2012-09-17T08:55:29.783 に答える