Skip to content

Commit

Permalink
Fix loading external registered components using a wrapper function
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Nov 30, 2024
1 parent df91150 commit 1594b8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pat/contentbrowser/src/SelectedItems.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// get selectedItem component from registry
const RegisteredSelectedItem = plone_registry.getComponent("pat-contentbrowser.SelectedItem");
console.log(RegisteredSelectedItem);
onMount(async () => {
await initializeSelectedItemsStore();
Expand Down Expand Up @@ -93,6 +92,10 @@
selectedItemsNode.dispatchEvent(events.change_event());
}
function LoadSelectedItemComponent(node, props) {
const component = new RegisteredSelectedItem.component({target: node, props: props});
}
$: {
$selectedItems;
if ($selectedItems.length || !initializing) {
Expand All @@ -113,7 +116,7 @@
on:click={() => $showContentBrowser = $selectedItems.length ? false : true }>
{#if $selectedItems}
{#each $selectedItems as selItem, i (selItem.UID)}
<svelte:component this={RegisteredSelectedItem.component} idx={i} item={selItem} />
<div use:LoadSelectedItemComponent={{idx:i, item:selItem}} />
{/each}
{/if}
{#if !$selectedItems}
Expand Down

0 comments on commit 1594b8b

Please sign in to comment.