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",
|
"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",
|
||||||
|
|
|
@ -51,7 +51,5 @@
|
||||||
.placeholder {
|
.placeholder {
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
height: 75px;
|
|
||||||
width: 300px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -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}
|
||||||
{@html embed}
|
<div class="embed" use:styleable={$component.styles}>
|
||||||
</div>
|
{@html embed}
|
||||||
|
</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>
|
||||||
|
|
|
@ -23,7 +23,5 @@
|
||||||
.placeholder {
|
.placeholder {
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
height: 75px;
|
|
||||||
width: 150px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue