Use block name in placeholders inside blocks

This commit is contained in:
Andrew Kingston 2022-10-14 19:13:44 +01:00
parent 5f7e0cb895
commit 622553978b
2 changed files with 5 additions and 1 deletions

View File

@ -67,6 +67,9 @@
// any depth // any depth
id: $component.id, id: $component.id,
// Name can be used down the tree in placeholders
name: $component.name,
// We register block components with their raw props so that we can eject // We register block components with their raw props so that we can eject
// blocks later on // blocks later on
registerComponent: registerBlockComponent, registerComponent: registerBlockComponent,

View File

@ -3,13 +3,14 @@
const { builderStore } = getContext("sdk") const { builderStore } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
const block = getContext("block")
export let text export let text
</script> </script>
{#if $builderStore.inBuilder} {#if $builderStore.inBuilder}
<div> <div>
{text || $component.name || "Placeholder"} {text || block?.name || $component.name || "Placeholder"}
</div> </div>
{/if} {/if}