Disable CloudCannon window global in the visual editor

CloudCannon injects an object onto the window object when viewed in the visual editor. This article will show how to turn off this behaviour. This is helpful if you are using anther global variable called CloudCannon.

To turn this off, we need to capture the cloudcannon:load event and call the disableGlobalInstall function.

document.addEventListener('cloudcannon:load', function (e) {
  const { CloudCannon } = e.details;
  CloudCannon.disableGlobalInstall();
});
Was this article helpful? or Suggest an improvement >

Related articles