Inserting text at the cursor position in Html Editor

I would need to implement a custom tool which would be able to insert a text into the current cursor position in the Html Editor control.

Any idea/trick how to achieve that inserting?

If somebody is interested the solution does not seem so difficult:

@code {
    private RadzenHtmlEditor myHtmlEditor;

    ....

    public async Task InsertHtml(string html)
    {
        // Inserts the text at the current cursor position.
        await myHtmlEditor.ExecuteCommandAsync("insertHTML", html);

        // Restore the cursor behind the inserted text.
        await myHtmlEditor.RestoreSelectionAsync();
    }
}
1 Like