this.embed.url && this.dispatchAction({ action: ActionType.Default, embed: this.embed }) && openUrl(this.embed.url, "_blank")}
@keydown=${clickOnEnterAndConsumeOnSpace}
@keyup=${clickOnSpace}
>
${(this.embed.type === "video" || this.embed.type === "rich") && this.embed.html
? html`
${unsafeHTML(this.embed.html)}
`
: nothing}
${this.embed.type === "photo" && this.embed.image && this.embed.thumbnail_url
? html`
`
: nothing}
${hasDescription
? html`
${this.embed.type === "link" && this.embed.image && this.embed.thumbnail_url
? html`
`
: nothing}
${this.embed.provider_name
? html`${this.embed.provider_name}`
: nothing}
${this.embed.title ? html`${this.embed.title}` : nothing}
${this.embed.description ? html`${this.embed.description}` : nothing}
${secondaryAction
? html`
{
e.stopPropagation();
this.dispatchAction({ action: secondaryAction, embed: this.embed });
}}
>
${secondaryAction}
`
: nothing}
${primaryAction
? html`
{
e.stopPropagation();
this.dispatchAction({ action: primaryAction, embed: this.embed });
}}
>
${primaryAction}
`
: nothing}
${actionList.length
? html`
${actionList.map(
(action) =>
html`
{
e.preventDefault();
e.stopPropagation();
this.dispatchAction({ action, embed: this.embed });
}}
>
${action}
`
)}
`
: nothing}
`
: nothing}
`;
}
protected override updated(_changedProperties: PropertyValues): void {
if (this.embedContentRef.value) {
const embedContent = this.embedContentRef.value.firstElementChild as HTMLElement;
const {width, height} = this.embedContentRef.value.dataset;
const parsedHeight = Number(height ?? '');
// If height is 128-256 use it as min height, otherwise 128
const minHeight = parsedHeight > 128 && parsedHeight < 256 ? parsedHeight : 128;
if (width && height) {
// Set aspect ratio to get proper resizing
embedContent.style.aspectRatio = `${width} / ${height}`;
// Use min of height and --wy-embed-content-max-size (as rendered value)
embedContent.style.minHeight = `${minHeight}px`;
}
}
}
}
/**
* Embed selector for multiple embeds (renders `