Kendo Editor copy and paste underlined

0 Answers 184 Views
Editor
Joseph
Top achievements
Rank 1
Joseph asked on 17 May 2021, 10:57 AM

Hi, 

We currently have a Kendo Editor with paste cleanup set as:

  pasteCleanup: {
all: false,
css: true,
custom: null,
keepNewLines: false,
msAllFormatting: true,
msConvertLists: true,
msTags: true,
none: false,
span: true

 

We've noticed an issue in that when copy and pasting underlined text within the control (not from external to the control), the underline is removed. I can only imagine that this is because we're stripping our SPANs with the above option. Our issue is that we can't really set this SPAN option to off as we explicitly do no want complex span elements being saved. Is there a workaround for this?

Thank you

Martin
Telerik team
commented on 20 May 2021, 10:03 AM

Indeed the behavior is caused because the spans are being stripped. The only possible approach I could think of would be to use a regex to match spans that contain the text-decoration-line: underline; style and replaced them with an <u> tag.
Joseph
Top achievements
Rank 1
commented on 20 May 2021, 11:01 AM

Thanks for your response, at which stage would his happen?
I found this example in the documentation, would it be something like this, but replaced with the regex you referred to?

<textarea id="editor"></textarea>
<script>
$("#editor").kendoEditor({
pasteCleanup: {
custom: function(html) {
return html.replace(/<img[^>]*>/, "");
}
}
});
</script>

Thanks!
Martin
Telerik team
commented on 25 May 2021, 09:17 AM

You can do it either that way or in the paste event. Please refer to the examples from the documentation that demonstrate how to use a regex on the e.html argument.

No answers yet. Maybe you can help?

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