#83639CKEditor: Using "data-cke-pa-onclick" to generate onclick attribute
Description
Following looks like a bug to me:
I wanted to add an onclick attribute to an tag.
As CKEditor uses onclick-Events it’s recommend (or even necessary?) to use data attributes like
data-cke-pa-onclick
which should be parsed on output.
In the backend this gets parsed on save, so after saving the record I have .
Once I save this record then again (e.g. editors change some text in this record), the onclick gets removed as it’s not allowed here.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 3
-
Susanne Moog changed category <span data-processor="relativetime" data-value="2018-01-23T21:43:33+00:00" > 01/23/18, 21:43 </span>
-
Alessandro Schmitz commented <span data-processor="relativetime" data-value="2018-05-03T17:00:41+00:00" > 05/03/18, 17:00 </span>
-
Andreas Nedbal commented and changed status
NewClosed <span data-processor="relativetime" data-value="2025-08-01T13:00:33+00:00" > 08/01/25, 13:00 </span>This issue was answered with the above comment already, this is not really a “workaround”, but required configuration, as the HTML parser strips out unsafe attributes by default, and the given configuration explicitly allows it.
Aside that, this issue concerns CKEditor 4 and this behaviour is most likely not even supported in the current version anymore. Plus, it will very likely cause major issues with CSP, regardless of it generally being a bad idea to use
onclickfrom a security aspect (especially in user-editable context).
A workarround currently is to allow the onclick attribute via YAML configuration with:
typo3link: additionalAttributes: - onclick