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

Empty HTML tags after select and delete

0 Answers 82 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Graham asked on 27 Sep 2010, 04:28 PM

We have an issue with the select and clear functionality within the text area of the Telerik Editor and hope that you can provide a resolution to it. In general when a user uses their mouse cursor to select a some text (within a small paragraph and including spaces or returns) then deletes it the related selected text formatting span, strong, em and paragraph tags remain within the HTML with the contents cleared.

The steps to re-produce this issue are as follows:

1.     Clear any contents from the editor including HTML.

2.     Add some text with varying formats and paragraph/line breaks.

3.     Select some or all of this text using the mouse cursor.

4.     Delete this text using the delete key on the keyboard.

5.     Open up the HTML view tab within the editor.

6.     It can be seen that the empty HTML tags are left.

Note:These steps were attempted within your editor demonstration page and the same results were acchieved
Address Used

I am aware of the ability to use filtering in javascript using 'getHtmlContent' or 'getDesignContent' and then use a '/<([a-zA-Z]+) ?[^>]*?>\s*<\/\1>/gi' regular expression to remove single instances of empty tags however this will not always work with multiple embedded spans and strong/em tags.

I have also noted that when the "select all" functionality used either as a shortcut 'Ctrl+A' or through the toolbar button is used then the contents deleted the HTML tags are also cleared however this does not occur if the editor contents are selected through the use of the mouse cursor 'Highlighted'.

Idealy we need the editor contents be updated as the user is inputting them (dynamically) and not on update or view change. This is a necessity as the editor contents need to be kept in close synchronisation with the saved/updated contents. If a filter is applied on update using the 'getHtmlContent' or 'getDesignContent' to remove empty HTML tags after we have found that it causes inconsistencies in the formatting result due to the removal of these empty HTML tags therefore we need to remove them before the update/save operation (dynamically).

Graham C

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question