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.

The old plugin content is deleted after clicking cancel with new nested plugins #641

@sgordeychuk

Description

@sgordeychuk

Steps to reproduce

  1. Create a Text plugin with some simple text content
  2. Save and publish the page
  3. Go to edit mode again and edit the same Text plugin
  4. Add any plugin using CMS Plugins menu
  5. Click cancel
  6. Reload the page

Expected result

Only new nested plugin was removed, but the text content and old plugins remains the same

Actual result

The whole content of plugin is cleared, the whole old published content is lost

Analysis

I've tried to debug the issue and found that cms.admin.placeholderadmin.PlaceholderAdminMixin.edit_plugin is called on Cancel click because newly created plugins should be cleared, which is make sense. Although inside that method I can see that new Text plugin instance is created, then plugins which are not needed should be cleared. But even adding plugin.body = obj.body there doesn't help, because it's being overwritten somewhere inside in operations.CHANGE_PLUGIN calls.

Do you have any ideas where to look at? I have a feeling that it's something with post_placeholder_operation call which doesn't copy the content from the old plugin, but not sure.

djangocms-test-ckeditor==5.1.1 (also reproducible with 5.1.2)
djangocms==3.9.0 (but also reproducible with 3.11.1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions