For the Confluence 4.0 version of our plugin we need to add data on HTML elements (more specific the h1-6 elements). We want to do this using the "data-" attribute as defined in the HTML specification.
Unfortunatly Confluence 4.0 removes these attribtues from the elements. As far as I can see this is done in two places; the tinymce plugin (both the "valid_elements" and "extended_valid_elements" variables do not let the heading elements have "data-" attributes) and somewhere in the Java code.
Is there any reason that these attributes get removed? If so, what is the preffered way to add data to the elements, so it is available when viewing the page. If not, is it possible to allow these attributes and leave them on the elements?
Community moderators have prevented the ability to post new answers.
Tomas and I have already discussed this quite thoroughly elsewhere but I thought it worth documenting the resolution we have come to for the moment.
Firstly, both TinyMCE and the security scanning in the Java backend strip attributes that we have not whitelisted. We are not going to enable arbitrary 'data-' attributes at the moment until we have worked out a good approach to addressing problems such as -
For now we are concentrating in getting 4.0 out of the door. The plan is to consider the above points as well as alternative mechanisms to meet the needs of plugin developers in this area after 4.0 is released.
The reason they're removed is because Atlassian uses them in the new editor (TinyMCE), and they get added and removed when you edit/save the page. I suspect they're not being specific about which 'data-' attributes are being nuked...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
They automatically get removed by TinyMCE, except for the "img" element. When I tell TinyMCE to keep the "data-" attributes for the headings, the attributes get removed somewhere in the Java code, I havn't figured out where though...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.