The Editor is not showing its Value in the following scenario:
Possible workarounds are:
Hello Alexey,
I made some additional experiments and it looks like you can also use a Task.Delay between the JSInterop call and setting the Editor Value: You may need the change the delay if the internet speed is slow.
@inject IJSRuntime js
<p><strong style="color:red">Copy and test this in a Blazor Server app.</strong></p>
<TelerikEditor @bind-Value="@PageContentBody" />
<script suppress-error="BL9992">function test() {
return "success";
}</script>
@code {
string PageContentBody { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
// Workaround 1: reorder the code
//PageContentBody = "<p><strong><span style='color:green;'>Initial Editor value</span></strong></p>";
//StateHasChanged();
// Workaround 2: add a delay here
//await Task.Delay(100);
var testString = await js.InvokeAsync<string>("test");
// Workaround 3: add a delay here
await Task.Delay(100);
PageContentBody = "<p><strong><span style='color:green;'>Initial Editor value</span></strong></p>";
StateHasChanged();
}
}
}
Regards,
Dimo
Progress Telerik
Hi Alexey,
These are indeed the available workarounds for the time being:
You may track the fix by subscribing for the item - this way you will get timely status updates.
Regards,
Nadezhda Tacheva
Progress Telerik