This is a migrated thread and some comments may be shown as answers.

Editing HTML content via View HTML Tool converting & to &amp

1 Answer 13 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 22 Apr 2021, 08:54 AM

Hi,

 

I have an issue with the Editor control where copy/pasting content with & into the "View HTML" tool window is converting the & to &amp. I've reproduced this behaviour in a pared down version of one of the jQuery demos here

Steps to reproduce:

- Click the View HTML button and copy/paste the following "<a href="https://clk.omgt1.com/?AID=1749609&PID=32811&UID=--MembershipNumber--" target="_blank" rel="noopener">"

- Click the Update button to save the change

- Click the View HTML button again and you can see that the content has been changed to this (emphasis mine to show the differences) - <a href="https://clk.omgt1.com/?AID=1749609&amp;PID=32811&amp;UID=--MembershipNumber--" target="_blank" rel="noopener"></a>

 

I've looked through the documentation and found the option for "encoded" which seems related but setting that to false doesn't fix this problem. Since this problem was originally reported via someone copy/pasting content into the window I've also tried modifying the paste options without success but I can also reproduce this via typing the problematic content in myself so copy/pasting doesn't seem related here.

 

Is there some other option that controls this behaviour or is it a bug with the control?

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 27 Apr 2021, 08:13 AM

Hello Lee,

I would suggest you take a look at the serialization and deserialization options. You could create custom rules depending on the scenario. Below is an example:

serialization: {        
          custom: function(html) {           
            return html.replace(/&amp;/g, "&");
          }
}

Here is a Dojo example where this is demonstrated. I hope you will find it helpful. 

Regards,
Neli
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
Editor
Asked by
Lee
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or