From df9115034d9353c73f94d785c85e6c19a4ea89d3 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Sat, 30 Nov 2024 13:32:54 -0300 Subject: [PATCH] some updates to registered component --- package.json | 5 +- src/pat/contentbrowser/contentbrowser.js | 16 +-- .../contentbrowser/src/SelectedItems.svelte | 12 +-- yarn.lock | 97 ++++++++++++++----- 4 files changed, 88 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 7686a4dff..b93dbb00d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@11ty/eleventy-upgrade-help": "2", "@patternslib/pat-code-editor": "4.0.1", "@patternslib/patternslib": "9.9.16", - "@plone/registry": "^1.7.0", + "@plone/registry": "^2.1.0", "backbone": "1.4.1", "backbone.paginator": "2.0.8", "bootstrap": "5.3.3", @@ -135,5 +135,6 @@ ], "publishConfig": { "access": "public" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/src/pat/contentbrowser/contentbrowser.js b/src/pat/contentbrowser/contentbrowser.js index 8f8f6e756..8710989a3 100644 --- a/src/pat/contentbrowser/contentbrowser.js +++ b/src/pat/contentbrowser/contentbrowser.js @@ -4,27 +4,21 @@ import registry from "@patternslib/patternslib/src/core/registry"; import utils from "../../core/utils"; import plone_registry from "@plone/registry"; -async function init_component_registry() { - // bug? set the component registry as empty dict the first time - // otherwise you get the error: "this._data.components is undefined" - if (plone_registry["components"] === undefined) { - // see @plone/registry - plone_registry["components"] = {}; - } - - if (plone_registry.getComponent("SelectedItem").component === undefined) { +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: "SelectedItem", + 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 -init_component_registry() +setup_default_component_registry() // Contentbrowser pattern diff --git a/src/pat/contentbrowser/src/SelectedItems.svelte b/src/pat/contentbrowser/src/SelectedItems.svelte index 84c8546a1..d7071f564 100644 --- a/src/pat/contentbrowser/src/SelectedItems.svelte +++ b/src/pat/contentbrowser/src/SelectedItems.svelte @@ -1,6 +1,6 @@