I would like to be able to customize the content of the Iframe in the Editor with CSS.
===
Telerik edit:
In the meantime, it is possible to inject CSS styles in the Editor <iframe> with JavaScript:
@inject IJSRuntime js
<TelerikEditor @bind-Value="@EditorValue" />
@* Move scripts to separate js files in production. *@
<script suppress-error="BL9992">
function injectEditorStyleTag() {
var doc = document.querySelector("iframe").contentWindow.document;
var head = doc.querySelector("head");
var style = doc.createElement("style");
style.type = "text/css";
var css = "body { background: #fed; font-size: 24px; }";
style.appendChild(doc.createTextNode(css));
head.appendChild(style);
}
</script>
@code {
private string EditorValue { get; set; } = "<p>The default font-size is 24px.</p>";
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await js.InvokeVoidAsync("injectEditorStyleTag");
}
}
}