onBackClick

Registers a callback that runs when a user clicks the Back button in the editor's header.

This function does not run when then the user uses the native "back" feature in their browser.

If you don't register the onBackClick callback, the "Back" button still appears in the Canva editor, but nothing happens when the user clicks it.

Usage

(async () => {
const api = await Canva.Partnership.initialize({
apiKey: "<partner_api_key>",
autoAuthToken: "<auto_auth_token>",
container: document.getElementById("container"),
});
const onBackClick = () => {
// the user has clicked the "Back" button in the editor's header
console.log("You clicked the 'Back' button!");
};
const onProductSelect = (opts) => {
api.createDesign({
...opts,
onBackClick,
});
};
api.showCatalog({
onProductSelect,
});
})();