TelerikEditor iFrame is not update upon value update

1 Answer 36 Views
Editor
Ricardo
Top achievements
Rank 1
Iron
Ricardo asked on 20 Feb 2024, 05:54 PM

I'm using the TelerikEditor component:

          <TelerikEditor @ref="@SummaryEditor"
                         Class="rich-editor"
                         EditMode="@EditorEditMode.Iframe"
                         Value="@TextDisplayModel.Text"
                         ValueChanged="@RichEditorValueChanges"
                         ValueExpression="@((()=> TextDisplayModel.Text))">
          </TelerikEditor>
And upon updating the variable TextDisplayModel.Text with a new value, the displayed text is not updated. I confirmed with DevTools that despite the textarea associated with the TelerikEditor component being updated, the iframe content does not update, as you can see on the following screenshot. Has anyone encountered this problem?

1 Answer, 1 is accepted

Sort by
0
Hristian Stefanov
Telerik team
answered on 23 Feb 2024, 09:03 AM

Hi Ricardo,

I have prepared an example of a working configuration that correctly updates the Editor's value in Iframe edit mode. Please use it as a reference.

Update Editor's value:
<TelerikTextArea @bind-Value="@TextDisplayModel.Text" />
<TelerikEditor @ref="@SummaryEditor"
               Class="rich-editor"
               EditMode="@EditorEditMode.Iframe"
               Value="@TextDisplayModel.Text"
               ValueChanged="@RichEditorValueChanges"
               ValueExpression="@((()=> TextDisplayModel.Text))">
</TelerikEditor>

@code {
    private TelerikEditor SummaryEditor { get; set; }
    private DisplayModel TextDisplayModel = new DisplayModel() { Text = "test" };

    private void RichEditorValueChanges(string value)
    {
        // update the view-model
        TextDisplayModel.Text = value;
    }

    public class DisplayModel
    {
        public string Text { get; set; }
    }
}

Let me know if you are still facing difficulties.

Regards,
Hristian Stefanov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Ricardo
Top achievements
Rank 1
Iron
commented on 12 Mar 2024, 04:28 PM

Hi Hristian!

I'm terribly sorry for taking so long to comment back!

I should have added that the TelerikTextArea element I mentioned is a child of the TelerikEditor component, it comes with it but is not visible. Sometimes, when I render my page, I cannot see the text on my TelerikEditor, but I can confirm via the DevTools window that the hidden TextArea was updated. Also, I update the view-model exactly has you suggested.

Hristian Stefanov
Telerik team
commented on 13 Mar 2024, 05:13 PM

Hi Ricardo,

I'm still not completely sure what your configuration looks like, except for the Editor. Could you clarify a bit more the issue here and provide a runnable reproduction so I can investigate further?

Kind Regards,

Hristian

Tags
Editor
Asked by
Ricardo
Top achievements
Rank 1
Iron
Answers by
Hristian Stefanov
Telerik team
Share this question
or