Completed
Last Updated: 29 Jul 2020 08:51 by ADMIN
Steve
Created on: 16 Jun 2016 12:29
Category: Editor
Type: Feature Request
3
Editor insertion bug
We have discovered an issue in the Editor around insertion of text using a custom button - it can be seen at http://dojo.telerik.com/EZijI

If you highlight text that is contained within a <span> tag, and use a custom button to insert more text (in this case, replacing the highlighted text), the text gets removed successfully, but the <span> gets closed, and the inserted text appears outside the closing </span> tag. 

Given that <span> tags can be used to format text, you therefore lose the formatting you had applied to the text you removed, and the new text appears unformatted i.e. inheriting formatting from the parent, which is not expected behaviour.
7 comments
ADMIN
Ivan Danchev
Posted on: 29 Jul 2020 08:51

Hi Julie,

Thank you for elaborating more on the desired behavior. We will monitor the interest of the community in changing the current behavior.

As for the remaining styling that could cause newly added text to get the formatting of the replaced text, this is true. Empty span elements remain after removing their content, and if you add new text within them, it will get the previous formatting. We have a "cleanFormatting" tool in the Editor to remove formatting, whenever this is needed: http://dojo.telerik.com/aQEjoSAy/4

Regards,
Ivan Danchev
Progress Telerik

Julie
Posted on: 22 Jul 2020 11:26

Hi Ivan,

I'm not sure if any editors do what we want. But we've had lots of users complain that this is what they expect and it's not happening. So they have to re-format the text that gets pasted in, instead of it just inheriting what was there before.

Second to this, the formatting tags are left in the HTML, meaning if i move the cursor to the right place before (or after) the inserted text, it's possible to get green highlighted text again. So, even if the user wanted the formatting to be reset, it still exists in the HTML and can possibly then cause problems by being there.

Julie

ADMIN
Ivan Danchev
Posted on: 22 Jul 2020 10:25

Julie,

I checked how Word behaves when you highlight all the green text and paste, and the pasted text appears without any background color. Is there a specific editor you have observed a different behavior in?

Regards,
Ivan Danchev
Progress Telerik

Julie
Posted on: 15 Jul 2020 12:04

perhaps the inserthtml/paste functions should take an option to preserve existing formatting so we have a choice. I can't ever think of a time when someone would want it to be inserted without using the formatting that's already there.

 

Julie

Julie
Posted on: 15 Jul 2020 11:47

Hi Ivan,

 

the issue still exists. The problem is when you highlight *all* of the text within the span and replace it. Using your Dojo, if i highlight all the green text and then press the custom button the HTML of the editor is now 

Span: <span style="background-color:lightgreen;"> </span>MY TEXT<span style="background-color:lightgreen;"> </span> 

 

This new text should have been inserted within the (now empty surrounding) span tags and should appear green.

 

Julie

ADMIN
Ivan Danchev
Posted on: 23 Jan 2020 11:47

Hello,

I tested the Editor behavior in the latest official version and I see no unexpected behavior. Consider this dojo example: http://dojo.telerik.com/aQEjoSAy

The span element has green background.

1. Highlight one of the words in the span, e.g. "users".
2. Click the custom button (the last one in the toolbar).
3. "MY TEXT" is inserted in the span and does not get any of the original span's formatting (in this case the background color). If you inspect the Html you will notice that the original span element is now replaced with two span elements and "MY TEXT" is inserted in between them:

<span style="background-color: lightgreen;"> Kendo UI Editor allows your </span>MY TEXT<span style="background-color: lightgreen;"> to edit HTML in a familiar, user-friendly way. </span>

This behavior is correct and is identical to copy/pasting text in the Editor. For example, if instead of using the custom button you copy (Ctrl+ C) the word "Span", then highlight "users" and paste (Ctrl + V) you will get the same result.

Word also acts similarly, the text is copied and pasted with its own formatting, it doesn't take the formatting of the line it is pasted in.

Regards,
Ivan Danchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
ADMIN
Petyo
Posted on: 16 Jun 2016 13:13
Hey,

this sounds like a bug to me. We collect these in the github repository - https://github.com/telerik/kendo-ui-core - you can open an issue there.