Rich Text Editor keyboard event args

Hi,
I am trying to detect when a user hits the enter key in the rich text editor.
I can see that there is a Syncfusion.EJ2.Blazor.RichTextEditor.KeyboardEventArgs option from a void.
But there is no option in the RTE events to listen for keyboard inputs. i.e. OnKeyUp etc.

Can you tell me how i would do that.

3 Replies

IS Indrajith Srinivasan Syncfusion Team March 11, 2020 12:27 PM UTC

Hi Fergus,

Greetings from Syncfusion support,

We have validated your reported query. RichTextEditor doesn't have any built-in support for native events binding. Instead, you can bind the necessary events wrapped for the <div> tag enclosed with RichTextEdior with its native event arguments. We have prepared a sample with keyup event binded for RichTextEditor.

Sample: https://www.syncfusion.com/downloads/support/forum/152300/ze/RTE_KeyboardAction-1729124191

Can you please try out the above solution and let us know if it meets your requirements?

Regards,
 
Indrajith 



NA Noor All Safaet February 28, 2023 01:32 AM UTC

@Indrajith Srinivasan I see your given source code. It doesn't get updated input value.

How do I get update value with the keyboard event?



VJ Vinitha Jeyakumar Syncfusion Team February 28, 2023 10:42 AM UTC

Hi Noor,


Your requirement to get the updated content value of the RichTextEditor control in the keyup event can be achieved by using the SaveInterval and bind-Value property. please check the code and sample attached below,

Code snippet:
<div @onkeyup="@onKeyup" style="height: auto; width: auto">
<SfRichTextEditor @bind-Value="@rteValue" SaveInterval="1">
   
</SfRichTextEditor>
</div>
@code {
    public string rteValue { get; set; } = "Rich Text Editor";
    public string content;
    private void onKeyup(Microsoft.AspNetCore.Components.Web.KeyboardEventArgs args)
    {
        // your action
        content = rteValue;
    }
}


Regards,
Vinitha

Loader.
Up arrow icon