Css is not working after refreshing the page in edit mode in jira confluence data center

we are trying to create one macro plugin. we have written below code on click of insert button on macro editor.

  let macroRenderRequest = {
        contentId: window.parent.AJS.Confluence.Editor.getContentId(),
        macro: {
          name: "q-assets",
          body: ReactDOMServer.renderToString(<QMacroRenderer />),
        },
      };
      window.parent.tinyMCE.confluence.MacroUtils.insertMacro(
        macroRenderRequest
      );

Macro plugin editor -

After click on insert button -

After refreshing the page it will display like below -

We have identified that our plugin code is working perfectly in editor but when we click on insert button, it will insert the data as simple HTML in preview mode and also confluence won’t have our plugin code after closing the macro editor. This behaviour of confluence will create css issue in edit mode.

3 Likes

@krishnashah I am also trying to do the same thing, for inserting macro I am using below code:

let macroRenderRequest = {
        contentId: AJSElement.Confluence.Editor.getContentId(),
        macro: {
          name: "q-assets-macro",
          body: "<style type='text/css'>@import url(cssfileurl)</style><body><div class='borderTest'>inline CSS</div></body>",
        },
      };
      window.parent.tinyMCE.confluence.MacroUtils.insertMacro(
        macroRenderRequest
      );

but when I click update button or refresh page my style tag get removed from macro body, If anyone can face this issue or found any solution let me know.