Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Confluence 4.0 HTML element data

Tomas Theunissen July 24, 2011

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?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Paul Curren
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2011

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 -

  • "Name spacing" of the attribute names to avoid clashes between plugins.
  • Storage format quickly becoming bloated with plugin specific data if a lot of plugins started to use this functionality.
  • How to remove plugin specific data from storage in a safe and quick way when a plugin is uninstalled.
  • What if we need to change storage format (still pre 4.0). The risk of breaking plugins is too large, and with this being the format's first outing, we don't want to be so constrained.

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.

0 votes
David Peterson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2011

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

Tomas Theunissen July 25, 2011

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

TAGS
AUG Leaders

Atlassian Community Events