updateMacro 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.
The updateMacro function accepts the following parameter:
| Name | Type | Description |
|---|---|---|
data | string | A stringified macro ADF object. |
1 2const params = { data: "<stringified_macro_adf_object>", };
This example shows how to use updateMacro.
1 2import { updateMacro } 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 updateMacro(updatedMacroADF); // Returns true or false
The updateMacro function returns true if the update was successful and false otherwise.
Rate this page: