Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-34797

Macro parameter with open brace ({) character messes the Macro element in the page editor

      I am coding a Confluence macro for which I have overriden the default macro editor dialog to get my own. I have a single string parameter in which I would like to store a JSON structure so I can easily parse it when the macro is edited again.

      When doing so, after saving the macro, the macro element on the page editor does not behave properly. It should display the name of the Macro along with the parameters if I wish to display them. Instead the name is replaced with the first element of my JSON object and the parameter part is the rest of the JSON object (see attached image). Is there any trick besides changing my storage format and parsing by hand ?

      When I edit the macro again, I do receive the data correctly. It is only a display problem in the Page Editor.

      Here is my macro definition

      <xhtml-macro name="canalmetadata" label="Canal Metadata"
                     class="com.confluence.plugins.metadata.macros.CanalMetadataMacro"
                     key="canal-metadata.macro">
          <description key="canal-metadata-macro.description">The metadata selection macro</description>
          <category name="confluence-content"/>
          <parameters>
              <parameter name="metaselection" type="string" required="true">
                  <option key="showNameInPlaceholder" value="false"/>
                  <option key="showValueInPlaceholder" value="false"/>
              </parameter>
          </parameters>
        </xhtml-macro>
      

      Steps to reproduce:

      1. Add Column macro to a page
      2. Set Column width parameter to "{test"

      Expected behaviour: Macro element in the page editor should have title "Column | width = {test".
      Actual behaviour: Macro element in the page editor has title "test".

        1. MacroTitleError.png
          2 kB
          Sebastien Delcoigne

            [CONFSERVER-34797] Macro parameter with open brace ({) character messes the Macro element in the page editor

            Atlassian Update - September 2019

            Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket.

            If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review.

            You can read more about the editor upgrade in the 6.14 Release Notes.

            Thanks

            Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            Makisa Appleton added a comment - Atlassian Update - September 2019 Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket. If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review. You can read more about the editor upgrade in the 6.14 Release Notes . Thanks Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            Hi,

            Thanks for your quick answer. My current workaround is the #1 in your list. I have changed the data structure to avoid JSON in parameters. I am not sure about your second proposition though. The parameter I wish to save is not meant to be displayed, but is still a set of data needed for the macro.

            Regards,

            Sebastien Delcoigne added a comment - Hi, Thanks for your quick answer. My current workaround is the #1 in your list. I have changed the data structure to avoid JSON in parameters. I am not sure about your second proposition though. The parameter I wish to save is not meant to be displayed, but is still a set of data needed for the macro. Regards,

            Dear sebastien.delcoigne,

            Thank you for raising this issue. I have two possible workarounds in my mind:

            1. Avoid content with open brace ({).
            2. Extend com.atlassian.renderer.v2.macro.basic.AbstractPanelMacro and move the JSON configuration to the panel the same way that Code macro does it.

            Regards
            Olli Nevalainen
            Confluence Bugmaster
            Atlassian

            Olli Nevalainen added a comment - Dear sebastien.delcoigne , Thank you for raising this issue. I have two possible workarounds in my mind: Avoid content with open brace ({). Extend com.atlassian.renderer.v2.macro.basic.AbstractPanelMacro and move the JSON configuration to the panel the same way that Code macro does it. Regards Olli Nevalainen Confluence Bugmaster Atlassian

              Unassigned Unassigned
              920d8db3161a Sebastien Delcoigne
              Affected customers:
              0 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: