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", "icon": "Code",
"description": "Embed content from 3rd party sources", "description": "Embed content from 3rd party sources",
"illegalChildren": ["section"], "illegalChildren": ["section"],
"styles": ["size"],
"settings": [ "settings": [
{ {
"type": "text", "type": "text",

View File

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

View File

@ -1,23 +1,29 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
import Placeholder from "./Placeholder.svelte"
const { styleable } = getContext("sdk") const { styleable, builderStore } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
export let embed export let embed
</script> </script>
<div use:styleable={$component.styles}> {#if embed}
<div class="embed" use:styleable={$component.styles}>
{@html embed} {@html embed}
</div> </div>
{:else if $builderStore.inBuilder}
<div use:styleable={{ ...$component.styles, empty: true }}>
<Placeholder />
</div>
{/if}
<style> <style>
div { .embed {
position: relative; position: relative;
} }
div :global(> *) { .embed :global(> *) {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute;
} }
</style> </style>

View File

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