How identify which macro are editing and retrieve macro parameters on Confluence page?

I’ve created a user macro for Confluence and I was trying to retrieve macro parameters by using attribution “data-macro-parameters” to re-edit this macro and update parameters of this macro.
Now I found if there are multiple macro on same page, Confluence could not identify which macro user trying to edit and retrieved correct macro parameters. Because when there is only one macro on the Confluence page, no problem. BUT if added multiple same, macros on the same page, then re-edit any of macro except the first one, I always get the first’s parameters, that because these macro all has attribution “data-macro-parameters”. How could identify which macro user wants to edit?

What I need is when user randomly click to edit the one macro of this page, can retrieve the parameters of this one, not the first one’s.

Im using Tinymce as editor and using javascript to getting macro parameters.

Here is the similar html code for my macro:

<img class="editor-inline-macro" src="/confluence/plugins/servlet/confluence/placeholder/macro?definition=e3Jtc3ZpZXdlci1tYWNybzpQYXJhbWV0ZXJzPXsicHJvamVjdCI6WyJXSElURSJdLCJ0YWciOlsiV0hJVEUxMjggcHVibGljIl0sImZpZWxkcyI6WyJpZCIsIkNhdGVnb3J5IiwiRGVzY3JpcHRpb24iLCJNaW4iLCJUeXAiLCJNYXgiLCJVbml0Il0sIm5vbnBhcmFtZmllbGRzIjpbImlkIiwiQ2F0ZWdvcnkiLCJUeXBlIiwiRGVzY3JpcHRpb24iXX19&amp;locale=en_GB&amp;version=2" data-macro-name="my-macro" data-macro-parameters="Parameters={&quot;project&quot;:[&quot;Woods&quot;],&quot;tag&quot;:[&quot;WHITE128 public&quot;],&quot;fields&quot;:[&quot;id&quot;,&quot;Category&quot;,&quot;Description&quot;,&quot;Min&quot;,&quot;Typ&quot;,&quot;Max&quot;,&quot;Unit&quot;],&quot;nonparamfields&quot;:[&quot;id&quot;,&quot;Category&quot;,&quot;Type&quot;,&quot;Description&quot;]}" data-macro-schema-version="1">

Any help could greatly appreciated.


1 Like