diff --git a/src/pat/contentbrowser/contentbrowser.js b/src/pat/contentbrowser/contentbrowser.js index 8710989a3..db7ecf35f 100644 --- a/src/pat/contentbrowser/contentbrowser.js +++ b/src/pat/contentbrowser/contentbrowser.js @@ -4,22 +4,6 @@ import registry from "@patternslib/patternslib/src/core/registry"; import utils from "../../core/utils"; import plone_registry from "@plone/registry"; -async function setup_default_component_registry() { - if (plone_registry.getComponent("pat-contentbrowser.SelectedItem").component === undefined) { - const SelectedItem = (await import("./src/SelectedItem.svelte")).default; - plone_registry.registerComponent({ - name: "pat-contentbrowser.SelectedItem", - component: SelectedItem, - }); - console.log("Loaded default 'SelectedItem' Component"); - } -} - -// register default components in @plone/registry -// here outside the pattern init() so that addons can override this -// when their bundle depends on the "plone" bundle -setup_default_component_registry() - // Contentbrowser pattern export const parser = new Parser("contentbrowser"); @@ -65,6 +49,14 @@ class Pattern extends BasePattern { async init() { this.el.style.display = "none"; + // register default components in @plone/registry + const SelectedItem = (await import("./src/SelectedItem.svelte")).default; + + plone_registry.registerComponent({ + name: "pat-contentbrowser.SelectedItem", + component: SelectedItem, + }); + // ensure an id on our element (TinyMCE doesn't have one) let nodeId = this.el.getAttribute("id"); if (!nodeId) {