Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sgordeychuk opened this issue Mar 22, 2023 · 7 comments

Comments

@sgordeychuk
Copy link
Contributor

sgordeychuk commented Mar 22, 2023

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)

@fsbraun
Copy link
Sponsor Member

fsbraun commented Mar 22, 2023

@sgordeychuk Thanks for this excellent bug report!

@sveetch
Copy link
Contributor

sveetch commented Jun 15, 2023

I reproduce it also with djangocms-text-ckeditor==5.1.2 and django-cms==3.11.1, i encountered this behavior and i thought about configuration problems before to search and see your report.

I wonder if a downgrade to djangocms-test-ckeditor<=5.1.1 could fix this temporarily, however a new migration have been passed in previous release so it's not a workaround for those ones that already upgraded recently..

@DmytroLitvinov
Copy link
Contributor

The same issue in our project.
Project setup:

  • Django 3.2.21
  • djangocms-text-ckeditor 5.1.3

@DmytroLitvinov
Copy link
Contributor

@fsbraun , @marksweb , hello.

Do we know when we can release new version of djangocms-text-ckeditor to pypi where there is such important fix?

@fsbraun
Copy link
Sponsor Member

fsbraun commented Sep 30, 2023

@DmytroLitvinov Here's the PR: #653

@sgordeychuk
Copy link
Contributor Author

sgordeychuk commented Oct 16, 2023

@fsbraun thanks a lot for the fix! I've tested it with my setup and everything works great now. Should I close the ticket or will you do it?

@fsbraun
Copy link
Sponsor Member

fsbraun commented Oct 16, 2023

Just done! Thanks ;-)

@fsbraun fsbraun closed this as completed Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants