Fix a few HTML rendering issues

pull/1003/head
Tyrrrz 2 years ago
parent d9a78d8e27
commit b5e0ec1c81

@ -434,20 +434,29 @@
</div>
}
// Generic image embed
else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Image?.Url))
else if (embed.Kind == EmbedKind.Image && !string.IsNullOrWhiteSpace(embed.Url))
{
var embedImageUrl =
embed.Image?.ProxyUrl ?? embed.Image?.Url ??
embed.Thumbnail?.ProxyUrl ?? embed.Thumbnail?.Url ??
embed.Url;
<div class="chatlog__embed">
<a href="@await ResolveAssetUrlAsync(embed.Image.ProxyUrl ?? embed.Image.Url)">
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embed.Image.ProxyUrl ?? embed.Image.Url)" alt="Embedded image" loading="lazy">
<a href="@await ResolveAssetUrlAsync(embedImageUrl)">
<img class="chatlog__embed-generic-image" src="@await ResolveAssetUrlAsync(embedImageUrl)" alt="Embedded image" loading="lazy">
</a>
</div>
}
// Generic gifv embed
else if (embed.Kind == EmbedKind.Gifv && !string.IsNullOrWhiteSpace(embed.Video?.Url))
else if (embed.Kind == EmbedKind.Gifv && !string.IsNullOrWhiteSpace(embed.Url))
{
var embedVideoUrl =
embed.Video?.ProxyUrl ?? embed.Video?.Url ??
embed.Url;
<div class="chatlog__embed">
<video class="chatlog__embed-generic-gifv" loop width="@embed.Video.Width" height="@embed.Video.Height" onmouseover="this.play()" onmouseout="this.pause()">
<source src="@await ResolveAssetUrlAsync(embed.Video.ProxyUrl ?? embed.Video.Url)" alt="Embedded video">
<video class="chatlog__embed-generic-gifv" loop width="@embed.Video?.Width" height="@embed.Video?.Height" onmouseover="this.play()" onmouseout="this.pause()">
<source src="@await ResolveAssetUrlAsync(embedVideoUrl)" alt="Embedded video">
</video>
</div>
}

@ -583,6 +583,8 @@
}
.chatlog__embed-generic-image {
object-fit: contain;
object-position: left;
max-width: 45vw;
max-height: 500px;
vertical-align: top;
@ -590,6 +592,8 @@
}
.chatlog__embed-generic-gifv {
object-fit: contain;
object-position: left;
max-width: 45vw;
max-height: 500px;
vertical-align: top;
@ -744,6 +748,7 @@
background-color: @Themed("#2f3136", "#f9f9f9");
font-family: "Consolas", "Courier New", Courier, monospace;
font-size: 0.85rem;
text-decoration: inherit;
}
.chatlog__markdown-pre--multiline {

Loading…
Cancel
Save