Issue Bug Closed

#83639CKEditor: Using "data-cke-pa-onclick" to generate onclick attribute

Alessandro Schmitz 01/22/18, 17:25 updated 08/01/25, 13:00

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

  1. Alessandro Schmitz commented <span data-processor="relativetime" data-value="2018-05-03T17:00:41+00:00" > 05/03/18, 17:00 </span>

    A workarround currently is to allow the onclick attribute via YAML configuration with:

        typo3link:
          additionalAttributes:
            - onclick
  2. Andreas Nedbal commented and changed status New Closed <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 onclick from a security aspect (especially in user-editable context).