Forge Macro Export Function "Custom UI" Limitation

Having the code block below in your manifest enables your macro to be included in the pdf or word file when your confluence page is exported.

modules:
  macro:
    - key: xxx-xxxx-xxx
      resource: main
      resolver:
        function: resolver
      title: Macro
      description: xxxxxxx
      export:
        function: xxxxx-export
  function:
    - key: xxxxx-export
      handler: export.run
app:
  id: ari:cloud:ecosystem::app/xxxxxx-xxxx-xxxx-xxxx-xxxx

The main limitation here is that the export function provided can only be UI kit.

Now, this works okay for macros built using the UI kit. But, it becomes difficult for the export function to support sophisticated macros built using Custom UI, simply because UI kit components are limited and cannot be extended (please correct me if I am wrong here).

Luckily, UI kit provides an image component. So, an image representation of your macro can be generated and stored “somewhere” passing the image URL in the image component src.

Also, you can create a base64 image representation of your macro and then pass the string in the image component src.

However, the first approach is complex and can leave some security risks as images with sensitive data are stored externally. With the second approach, you run into the risk of " request entity too large" error when the image base64 string representation is too large.

So, I would like to ask the following questions to the Forge team:

  1. Are there currently other ways to export macros with complex UIs built using Custom UI?
  2. How do you plan to support macros with complex UI that are built with Custom UI?
  3. Is there any timeline for this?

All comments are welcomed.

Thanks.

9 Likes

We are also looking for a better macro export experience, especially for Custom UI.

3 Likes

Hello @OnucheIdoko1 ,

I’m Engin, an engineer in Confluence Ecosystem team. I’m one of the engineers who worked on the export functionality.

I’m curious how are you generating the image. How difficult is it?
An idea for storage is storing the image as an attachment in the page.

Hello @EnginTekin

We have an external service that serves images. So basically, we send the service some html and the service serves the content as png. Then the response is converted to base64: data:image/png;base64,${imageBase64} and used in the UI Kit Image src atribute.

We want to avoid storing this anywhere. Because, the job here is to include the macro when the page is exported. Also, storage does not solve the export function limitation.

HI @EnginTekin Please, any ideas on how to better achieve this?

Related: Forge Macro can not be exported as PDF

It appears the export feature is not working?

As described in the ticket (which appears to be the case for UI kit macro), it’s not working for my Custom UI macro either

Hello @EnginTekin
It’s 2024 and the export feature is still limited to UI Kit 1.
UI Kit 1 looks like it has been deprecated and I see the efforts are made towards UI Kit 2.

I kinda understand that the rendering should occur server side since the export is running on the server, but as the OP mentioned, that’s a huge limitation especially when using Custom UI for an advanced component.

We are developing a Confluence Macro using Custom UI and we want to export a flatten representation of the data (for example User names in replacement of clickable User icons in the macro).
The components in UI Kit 1 are very limited and cannot provide a decent (to our standards) output when exporting a Confluence page.

Any news on this front ?
Maybe @AdamMoore has info about using Custom UI or UI Kit 2 for this export feature ? It would be great !

Thanks !

1 Like

Hey @FabienLydoire, no news to share today - but yes macro export is one of the last places that only supports UI Kit 1. It’s something we’ll be looking at in the next quarter and we’ll have a replacement before we start any official deprecation process for UI Kit 1.

2 Likes

Hi, I am a bit confused since it says: “Note: This function also works for Custom UI macros, even though it is a UI kit function.” in the documentation for the export function, yet when I try to use it I keep getting the error: “Cannot find name ‘ForgeUI’.[tsl] ERROR in ” Does this mean the documentation is misleading or am I implementing something wrong?

https://developer.atlassian.com/platform/forge/manifest-reference/modules/macro/#properties