Ver Fonte

Fix `TypeError` when trying to use `@converse/headless`

Fixes #2788
JC Brand há 3 anos atrás
pai
commit
337638034f
2 ficheiros alterados com 4 adições e 1 exclusões
  1. 1 0
      CHANGES.md
  2. 3 1
      src/headless/core.js

+ 1 - 0
CHANGES.md

@@ -9,6 +9,7 @@
 - #1761: Add a new dark theme based on the [Dracula](https://draculatheme.com/) theme
 - #2751: Media not rendered when Converse runs in a browser extension
 - #2786: Fix webpack configuration not working on Windows OS
+- #2788: `TypeError` when trying to use `@converse/headless`
 - #2789: Implement new hook `parseMessageForCommands` for plugins to add custom commands
 
 

+ 3 - 1
src/headless/core.js

@@ -740,7 +740,9 @@ Object.assign(converse, {
         initPlugins(_converse);
 
         // Register all custom elements
-        api.elements.register();
+        // XXX: api.elements is defined in the UI part of Converse, outside of @converse/headless.
+        // This line should probably be moved to the UI code as part of a larger refactoring.
+        api.elements?.register();
 
         registerGlobalEventHandlers(_converse);