Fix embed showing undefined, add size styles and add placeholder

This commit is contained in:
Andrew Kingston 2021-06-25 16:04:42 +01:00
parent c02a7ef311
commit 930b0b774f
4 changed files with 14 additions and 11 deletions

View File

@ -1071,6 +1071,7 @@
"icon": "Code",
"description": "Embed content from 3rd party sources",
"illegalChildren": ["section"],
"styles": ["size"],
"settings": [
{
"type": "text",

View File

@ -51,7 +51,5 @@
.placeholder {
display: grid;
place-items: center;
height: 75px;
width: 300px;
}
</style>

View File

@ -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}>
{#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>

View File

@ -23,7 +23,5 @@
.placeholder {
display: grid;
place-items: center;
height: 75px;
width: 150px;
}
</style>