Fix embed showing undefined, add size styles and add placeholder
This commit is contained in:
parent
d0d38387ad
commit
b6a62de0d3
|
@ -1071,6 +1071,7 @@
|
|||
"icon": "Code",
|
||||
"description": "Embed content from 3rd party sources",
|
||||
"illegalChildren": ["section"],
|
||||
"styles": ["size"],
|
||||
"settings": [
|
||||
{
|
||||
"type": "text",
|
||||
|
|
|
@ -51,7 +51,5 @@
|
|||
.placeholder {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
height: 75px;
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,23 +1,29 @@
|
|||
<script>
|
||||
import { getContext } from "svelte"
|
||||
import Placeholder from "./Placeholder.svelte"
|
||||
|
||||
const { styleable } = getContext("sdk")
|
||||
const { styleable, builderStore } = getContext("sdk")
|
||||
const component = getContext("component")
|
||||
|
||||
export let embed
|
||||
</script>
|
||||
|
||||
<div use:styleable={$component.styles}>
|
||||
{@html embed}
|
||||
</div>
|
||||
{#if embed}
|
||||
<div class="embed" use:styleable={$component.styles}>
|
||||
{@html embed}
|
||||
</div>
|
||||
{:else if $builderStore.inBuilder}
|
||||
<div use:styleable={{ ...$component.styles, empty: true }}>
|
||||
<Placeholder />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
div {
|
||||
.embed {
|
||||
position: relative;
|
||||
}
|
||||
div :global(> *) {
|
||||
.embed :global(> *) {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -23,7 +23,5 @@
|
|||
.placeholder {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
height: 75px;
|
||||
width: 150px;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue