mautic icon indicating copy to clipboard operation
mautic copied to clipboard

Trying to edit a Text block in CKE, which contains unsupported html attributes or tags, clears out the entire block

Open LordRembo opened this issue 1 year ago • 2 comments

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).

Screenshot 2024-05-06 at 13 25 40 Screenshot 2024-05-06 at 13 27 14

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.

Screenshot 2024-05-06 at 13 25 57

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.

LordRembo avatar May 06 '24 11:05 LordRembo

Posted a PR to fix this: https://github.com/mautic/mautic/pull/13725

LordRembo avatar May 06 '24 12:05 LordRembo

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 avatar May 08 '24 13:05 abhisekmazumdar

@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?

LordRembo avatar May 10 '24 10:05 LordRembo

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.

abhisekmazumdar avatar May 10 '24 11:05 abhisekmazumdar

⚠️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.

github-actions[bot] avatar May 10 '24 11:05 github-actions[bot]