@dotcms/uve 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
package/public.cjs.js CHANGED
@@ -970,14 +970,18 @@ function listenBlockEditorInlineEvent() {
970
970
  listenBlockEditorClick();
971
971
  return {
972
972
  destroyListenBlockEditorInlineEvent: () => {
973
- window.removeEventListener('load', () => listenBlockEditorClick());
973
+ // No need to remove listener if page was already loaded
974
974
  }
975
975
  };
976
976
  }
977
- window.addEventListener('load', () => listenBlockEditorClick());
977
+ // If the page is not fully loaded, listen for the DOMContentLoaded event
978
+ const handleDOMContentLoaded = () => {
979
+ listenBlockEditorClick();
980
+ };
981
+ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded);
978
982
  return {
979
983
  destroyListenBlockEditorInlineEvent: () => {
980
- window.removeEventListener('load', () => listenBlockEditorClick());
984
+ document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
981
985
  }
982
986
  };
983
987
  }
package/public.esm.js CHANGED
@@ -968,14 +968,18 @@ function listenBlockEditorInlineEvent() {
968
968
  listenBlockEditorClick();
969
969
  return {
970
970
  destroyListenBlockEditorInlineEvent: () => {
971
- window.removeEventListener('load', () => listenBlockEditorClick());
971
+ // No need to remove listener if page was already loaded
972
972
  }
973
973
  };
974
974
  }
975
- window.addEventListener('load', () => listenBlockEditorClick());
975
+ // If the page is not fully loaded, listen for the DOMContentLoaded event
976
+ const handleDOMContentLoaded = () => {
977
+ listenBlockEditorClick();
978
+ };
979
+ document.addEventListener('DOMContentLoaded', handleDOMContentLoaded);
976
980
  return {
977
981
  destroyListenBlockEditorInlineEvent: () => {
978
- window.removeEventListener('load', () => listenBlockEditorClick());
982
+ document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
979
983
  }
980
984
  };
981
985
  }