8000 "text_enabled" plugins in Text plugin become uneditable after saving · Issue #405 · django-cms/djangocms-text-ckeditor · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
"text_enabled" plugins in Text plugin become uneditable after saving #405
@czpython

Description

@czpython

Taken from django-cms/django-cms#5787 by @bcdickinson:

Using a simplified version of the HelloPlugin class from the tutorial, but with text_enabled set to True:

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin

from django.utils.translation import ugettext_lazy as _
from django.templatetags.static import static

class HelloPlugin(CMSPluginBase):
    model = CMSPlugin
    render_template = "hello_plugin.html"
    cache = False
    text_enabled = True

    def icon_src(self, instance):
        return static('user.svg')

plugin_pool.register_plugin(HelloPlugin)

hello_plugin.html:

<h1>Hello</h1>

When it's first added to a text plugin everything works as expected:
first

... however, once the containg Text plugin is saved and reopened then the content of the plugin ("Hello") is no longer a plugin block, but editable text. Additionally, the <cms-plugin> element is now empty in the source view:

<p>Real text content</p>

<p><cms-plugin alt="Hello Plugin - 21 " id="21" render-plugin="true" title="Hello Plugin - 21"></cms-plugin></p>

<h1>Hello</h1>

<p>&nbsp;</p>

Saving and reopening the parent text plugin adds a new occurrence of the text every time after this, too:

<p>Real text content</p>

<p><cms-plugin alt="Hello Plugin - 21 " id="21" render-plugin="true" title="Hello Plugin - 21"></cms-plugin></p>

<h1>Hello</h1>

<p>&nbsp;</p>

<h1>Hello</h1>

<p>&nbsp;</p>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0