UI Kit components
Jira UI Kit components
UI Kit hooks
Forge bridge APIs
Jira bridge APIs
Confluence bridge APIs
Upgrade UI Kit versions
Previous versions

updateMacroContent

updateMacroContent is an asynchronous function that allows your macro to update itself. It takes in a macro ADF parameter and returns true if the update succeeded and false if it failed. This function works only in edit modes (e.g. a Live Doc or edit mode of a Page). You can get this info from the isEditing property in the extension context.

Function Parameter

The updateMacroContent function accepts the following parameter:

NameTypeDescription
datastringA stringified macro ADF object.

Example

1
2
const params = {
    data: "<stringified_macro_adf_object>"
};

Example

This example shows how to use updateMacroContent.

1
2
import { updateMacroContent } from '@forge/confluence-bridge';

const newMacroADF = {
  type: "extension",
  attrs: {
    extensionKey: "cool-macro",
    extensionType: "com.atlassian.ecosystem",
    localId: "0",
    parameters: {
        "localId": "0",
        "extensionId": "cool-macro",
        "extensionTitle": "Cool macro",
        "layout": "extension",
        "forgeEnvironment": "DEVELOPMENT",
        "render": "native"
    },
    text: "Cool macro",
  },
};

const updatedMacroADF = {
  data: JSON.stringify(newMacroADF),
}

const updateMacroContentResult = await updateMacroContent(updatedMacroADF); // Returns true or false

Response Type

The updateMacroContent function returns true if the update was successful and false otherwise.

Rate this page:

OSZAR »