Maui richtexteditor text changed event

1 Answer 39 Views
RichTextEditor
David
Top achievements
Rank 1
David asked on 08 Jan 2025, 08:41 PM
is there a way to get a textchanged event on the richtexteditor?

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 08 Jan 2025, 09:09 PM

Hello David,

Currently there is not a TextChanged event. We do have a Feature Request open for this (RichTextEditor: Provide a notification for content changes), I have gone ahead and added an upvote on your behalf.

In the meantime, the only way to determine changes is to compare before and after the suspected change:

// Maybe store this a private field
var initialHtmlString = await this.richTextEditor.GetHtmlAsync();

// SOME TIME/EVENT OCCURS (e.g. keyup event)
public bool CheckEditorContentChanged()
{
    var htmlStringToCompare = await this.richTextEditor.GetHtmlAsync();

    if(initialHtmlString.Equals(htmlStringToCompare))
    {
        // nothing changed
        return false;
    }
    else
    {
        // text content, formatting, style, etc has changed
        return true;
    }
}

Regards,
Lance | Senior Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Nico
Top achievements
Rank 1
commented on 28 Feb 2025, 08:58 AM

Hello Lance,

i've tried to work around this using the Focused and Unfocused event on RichTextEditor.
But unfortunately both aren't fired. Any suggenstions?

thx
Nico

Didi
Telerik team
commented on 28 Feb 2025, 09:09 AM

Hi Nico,

The focused and unfocused events do not fire. This is due to the interval WebView we use in the RichTextEditor control.

Cast your vote for the following feature request for focusing the control programmatically: https://feedback.telerik.com/maui/1675327-richtexteditor-provide-an-option-to-focus-the-control-programmatically 

Nico
Top achievements
Rank 1
commented on 28 Feb 2025, 09:48 AM

Hi Didi,

after a deeper look into how the control works inside i've found a workaround:

It should only be a small effort for Telerik to implement the corresponding feature request and thus give others the TextChanged event.
Or alternatively to make the focused and unfocused event of the internal RadTextView available in the RadRichEditor

But at least there is now a workaround that others who are looking for it can work with
Didi
Telerik team
commented on 28 Feb 2025, 09:54 AM

Hi Nico,

Thank you for the update. May I ask you to add the workaround as a comment to the public item here: https://feedback.telerik.com/maui/1675327-richtexteditor-provide-an-option-to-focus-the-control-programmatically

Thank you in advance.

Tags
RichTextEditor
Asked by
David
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or