Trying to edit a Text block in CKE, which contains unsupported html attributes or tags, clears out the entire block
Mautic Version
5.0.x series
Way of installing
I cloned the Mautic repo (not recommended or supported)
PHP version
8.2
What browsers are you seeing the problem on?
Not relevant
What happened?
I ran into a bug with CKEditor, where the editing a Text block just gives you an empty block. Reason was that there’s (hidden) html attributes present in the editable content of a Text block. Eg. an ID or a title attribute on a link. Normally, I would expect CKE to simply strip out any offending parts, but that didn't happen in my use case.
You can see this happen in the Brienz theme, where some extra attributes exist on links in the prefilled content of the small contact block near the top (eg. a title). See screenshot of the preview and the html (when inspected in browser).
Now double-click to open and Edit in CKE, you get an empty area. Saving this, also clears the content in preview and in the html. So the only way to edit this block, is to start from scratch.
Now, I don’t know why those ID’s are in there (since you can't edit source code as a user), but they just look generated by the system itself. They weren't a problem in Mautic 4, so it shouldn't be allowed to break in Mautic 5. The best fix, I think is to put back what was done in CKE4: re-enable the use of (some) html elements/attributes. We can limit it to just the links for now, as CKE5 has more granular control.
How can we reproduce this issue?
Step 1: Make a new mail Step 2: Choose Brienz as the template Step 3: Open the contact block Step 4: The content in CKE is empty
(see also the screenshots in the description)
Relevant log output
No response
Code of Conduct
- [X] I confirm that I have read and agree to follow this project's Code of Conduct
Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.
Posted a PR to fix this: https://github.com/mautic/mautic/pull/13725
I followed the steps and setup a fresh instance of Mautic locally using ddev. But I was not able to reproduce this issue at my end.
@abhisekmazumdar Ah, okay that is very strange. Regardless of the content disappearing or not though, when you open the text block in CKE and save it, are the title properties on the links preserved or are they removed?
Yes, you are right. I see those titles getting lost.
Upon testing the PR https://github.com/mautic/mautic/pull/13725, I believe it solves this issue.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If this issue is continuing with the lastest stable version of Mautic, please open a new issue that references this one.