I bind the MudExRichTextEdit component's value to a string property in my model class.
@bind-Value="@question.HintText"
And when ValueHtmlBehavior=Semantic HTML
the content <pre /> gets stripped out..
If I use the control and add a 'code / pre' section it persisted to the value binding of the MudExRichTextEdit and I can successfully store the value. But upon loading this control and having it directly bound to the property of my model (question.HintText) the
is stripped out.
note: if I set the binding mode to "InnerHTML" then it works fine. I just prefer the Semantic HTML approach.
I guessing this might be an issue with Quill, or perhaps it is the order in which the binding of the ValueHtmlBehaviour and Value properties are set?
Thanks in Advance
Great work with this library!
@using MudBlazor.Extensions.Helper
@using MudExRichTextEditor.Types
@inject IJSRuntime _jsRuntime;
<MudGrid>
<MudItemD Class="pt-10" xs="12">
<MudDivider />
</MudItemD>
<MudItem Class="pt-4 pb-2" xs="12">
<MudText Typo="Typo.subtitle2" Color="Color.Primary">
<MudIcon Icon="@Icons.Material.Filled.Help" Class="mr-3 mb-n1" />
Help/Hint Content
</MudText>
</MudItem>
<MudItem Class="pt-4 pl-5 pr-0 pb-2" xs="12">
<MudExRichTextEdit @ref="_editor"
ReadOnly="@_readOnly"
Immediate="@_updateValueOnChange"
Height="400"
EnableResize="true"
ValueHtmlBehavior="@_bindingMode"
@bind-Value="@question.HintText"
Placeholder="@_placeholder">
</MudExRichTextEdit>
</MudItem>
<MudFlexBreak />
<MudItem Class="pt-4 pb-2" xs="12">
@ChildContent
</MudItem>
<MudFlexBreak />
</MudGrid>
<QuestionOptionsEdit options="@question.Options" questionType="@question.GetType()" />
@code {
[Parameter, EditorRequired] public required QuestionDto question { get; set; }
[Parameter] public RenderFragment? ChildContent { get; set; }
private MudExRichTextEdit _editor;
private bool _readOnly = false;
private bool _updateValueOnChange = true;
private string _placeholder = "Optional HTML content to assist the user answer this question.";
private GetHtmlBehavior _bindingMode = GetHtmlBehavior.InnerHtml;
}
I bind the MudExRichTextEdit component's value to a string property in my model class.
@bind-Value="@question.HintText"And when ValueHtmlBehavior=Semantic HTML
the content
<pre />gets stripped out..If I use the control and add a 'code / pre' section it persisted to the value binding of the MudExRichTextEdit and I can successfully store the value. But upon loading this control and having it directly bound to the property of my model (question.HintText) the