I'm binding a string variable, NoteBody, to the editor as such:
<SfRichTextEditor @ref="RTFeditor" @bind-Value=NoteBody EnableXhtml=true>
<RichTextEditorToolbarSettings Items="@Tools">
<RichTextEditorCustomToolbarItems>
<RichTextEditorCustomToolbarItem Name="Save">
<Template>
<button class="e-btn e-tbar-btn" @onclick="onSaveClick">
<div class="e-tbar-btn-text" style="font-weight: 500;">💾</div>
</button>
</Template>
</RichTextEditorCustomToolbarItem>
</RichTextEditorCustomToolbarItems>
</RichTextEditorToolbarSettings>
</SfRichTextEditor>
- On a newly loaded page, NoteBody contains the typed editor text on save (via the onSaveClick handler)
- On a page where NoteBody has been assigned from a previously saved note, it displays in the editor but additional changes are *not* updating NoteBody on save
- When NoteBody is assigned from a previously saved note and then Ctrl-A is used to select all text, then Delete key pressed to delete it, newly entered text DOES update NoteBody on save.
Help?
| <SfRichTextEditor EnablePersistence="true" >
</SfRichTextEditor> |
That doesn't fix the issue. The problem is that the RTF control shows what I set in the NoteBody variable, it shows additional typed text after that, but when processing the save, the newly typed text isn't part of what's set in NoteBody. It's clearly a bug that the control itself shows all of the text, old+newly added/edited text, but doesn't set what it shows into the bound variable.
|
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.RichTextEditor
<SfRichTextEditor @ref="RTFeditor" @bind-Value="@NoteBody" EnableXhtml=true SaveInterval=1>
<RichTextEditorToolbarSettings Items="@Tools">
<RichTextEditorCustomToolbarItems>
<RichTextEditorCustomToolbarItem Name="Symbol">
<Template>
<button class="e-btn e-tbar-btn" @onclick="onSaveClick">
<div class="e-tbar-btn-text" style="font-weight: 500;">💾</div>
</button>
</Template>
</RichTextEditorCustomToolbarItem>
</RichTextEditorCustomToolbarItems>
</RichTextEditorToolbarSettings>
</SfRichTextEditor>
@code {
SfRichTextEditor RTFeditor;
public string NoteBody = "Rich Text Editor";
private void onSaveClick()
{
Console.WriteLine(RTFeditor.Value);
Console.WriteLine(NoteBody);
}
} |
Thanks, hopefully that works.