<button class="e-btn e-outline" @onclick="@getTextHtml">Text After Html</button>
<button class="e-btn e-outline" @onclick="@getHtmlText">Html After Text</button> // Button click to call the GetText and GetHtml method
<br><br>
<EjsRichTextEditor @ref="rte">
<p>Sample Text</p>
</EjsRichTextEditor>
<br>
<div>
<b>Text After Html result</b>
<br>
<pre>@output1</pre> // Used to print the output1 variable result in DOM
<br>
<b>Html After Text result</b>
<br>
<pre>@output2</pre> // Used to print the output2 variable result in DOM
</div>
@code{
EjsRichTextEditor rte;
private string output1 = "";
private string output2 = "";
private async void getTextHtml()
{
var text = await this.rte.GetText();
var html = await this.rte.GetHtml();
this.output1 = "getText method Result: " + text + "\n\n";
this.output1 = this.output1 + "getHtml method Result: " + html;
StateHasChanged(); // Used for append the current change of output1 variable into DOM
}
private async void getHtmlText()
{
var html = await this.rte.GetHtml();
var text = await this.rte.GetText();
this.output2 = "getHtml method Result: " + html + "\n\n";
this.output2 = this.output2 + "getText method Result: " + text;
StateHasChanged();// Used for append the current change of output2 variable into DOM
}
}
|