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 d0d38387ad
commit b6a62de0d3
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}>
{@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>

View File

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