
This makes sure the AngleSharp owner document is only created once per application lifecycle, and replaces all async calls with their synchronous counterparts (since the input is already loaded in memory, using async for this just creates overhead)
30 lines
No EOL
1.1 KiB
Text
30 lines
No EOL
1.1 KiB
Text
@using Iceshrimp.Frontend.Core.Miscellaneous
|
|
@using Iceshrimp.Frontend.Core.Services
|
|
@using Iceshrimp.Shared.Schemas.Web
|
|
@inject MetadataService MetadataService
|
|
@TextBody
|
|
|
|
@code {
|
|
[Parameter] [EditorRequired] public required string? Text { get; set; }
|
|
[Parameter] public List<EmojiResponse> Emoji { get; set; } = [];
|
|
[Parameter] public bool Simple { get; set; } = false;
|
|
private MarkupString TextBody { get; set; }
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (Text != null)
|
|
{
|
|
var instance = await MetadataService.Instance.Value;
|
|
TextBody = MfmRenderer.RenderString(Text, Emoji, instance.AccountDomain, Simple);
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
if (Text != null)
|
|
{
|
|
var instance = await MetadataService.Instance.Value;
|
|
TextBody = MfmRenderer.RenderString(Text, Emoji, instance.AccountDomain, Simple);
|
|
}
|
|
}
|
|
} |