<head>
. . .
<script src="~/jsinterop.js"></script>
</head> |
<SfRichTextEditor @ref="@rteObj">
<RichTextEditorEvents OnImageSelected="@ImageSelectedEventHandler"></RichTextEditorEvents>
<p>Rich Text Editor allows to insert images from online source as well as local computer where you want to insert the image in your content.</p>
</SfRichTextEditor>
<style>
.e-img-content .e-linkheader, .imgUrl {
display: none;
}
</style>
@code {
SfRichTextEditor rteObj;
[Inject]
IJSRuntime JsRuntime { get; set; }
private bool dialogHide { get; set; } = true;
public void ImageSelectedEventHandler(Syncfusion.Blazor.Inputs.SelectedEventArgs args)
{
if (dialogHide)
{
args.Cancel = true;
var currentID = this.rteObj.ID + "_image";
JsRuntime.InvokeAsync<string>("RichTextEditor.dialogClose", currentID);
}
}
} |
window.RichTextEditor = {
dialogClose: function (imageDialog) {
document.getElementById(imageDialog).blazor__instance.hide();
}
} |