PasteCleanup option not stripping HTML/styling

0 Answers 177 Views
Editor
Lee
Top achievements
Rank 1
Lee asked on 08 Sep 2021, 11:57 AM

Hi,

I have a Kendo Editor control on one of my pages which I've enabled the "paste cleanup" feature on with the flags "all" and "css" but when I copy/paste content with HTML tags and inline CSS styles into it, those tags/styles are not being removed as expected.

This can be seen on the paste cleanup feature demo page - https://demos.telerik.com/kendo-ui/editor/paste-cleanup when pasting in the following HTML snippet

<h1 style="text-align:center;"><strong>The simple way to get a brand new bike, make huge savings and spread the cost</strong></h1>

 

I've tried various combinations of the options available on that page but nothing works so is there a way of achieving the expected result?

 

 

Ivan Danchev
Telerik team
commented on 13 Sep 2021, 08:57 AM

Hi Lee,

I've checked how the Editor behaves when pasting the Html you posted and at my end the styles and tags were removed as expected. See the attached video. I've tested it in Chrome and Firefox.

Which browser(s) do you notice the problem in? Do you follow any extra steps for the problem to be exhibited?

Lee
Top achievements
Rank 1
commented on 20 Sep 2021, 03:19 PM

Hi,

Apologies for the delay in responding, I've been away for the past week. Watching your video I can see that you are copy/pasting the HTML content from the browser window which seems to work as you show, but if you copy and paste the actual HTML markup that doesn't work and the tags/styling present in the HTML are rendered within the Editor control.

So for example this works in that the HTML tags/styles are stripped:

- take the HTML from the original question and save it as test.html

- open that HTML file in Chrome (for example)

- copy the text

- paste it into the paste cleanup demo

 

But if you do this instead, it doesn't work in that the tags/styles are displayed

- take the HTML from the original question and save it as test.html

- open test.html in Notepad

- copy the HTML

- paste it into the paste cleanup demo

 

Anton Mironov
Telerik team
commented on 23 Sep 2021, 01:15 PM

Hi Lee,

Thank you for the additional details provided.

The "all" option is getting the HTML tags and apply them as the browser reads them. This is the reason the tags and styles are applied when you are pasting them from the Notepad. The "none" option is representing all the content(along with the tags and styles) as plain text, taking its already applied styles.

So, in order to apply the tags and styles when using the Notepad content, use the "all" option.

When the tags and styles are already applied to a text, use the "none" option.

I hope this information helps.

Kind Regards,
Anton Mironov 

No answers yet. Maybe you can help?

Tags
Editor
Asked by
Lee
Top achievements
Rank 1
Share this question
or