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

Prevent RadEditor from closing tags

5 Answers 132 Views
Editor
This is a migrated thread and some comments may be shown as answers.
David Kalsbeek
Top achievements
Rank 1
David Kalsbeek asked on 09 Mar 2011, 04:31 PM
I've got two RadEditors collecting static content to put above and below some data driven content that will wind up rendering out on the page like

<body>
<< content from RadEditor1 >>
<< data driven content >>
<< content from RadEditor2 >>
</body>

I'd like to allow a <div> or <table><tr><td> to be left open in RadEditor1 to be followed by </div> or </td></tr></table> in RadEditor2 (this would be entered in the HTML view of the editor).

I've tried setting the ContentFilters to None and the RadEditor automatically closed the tags. So RadEditor HTML would start with <table><tr><td> and when I switch to the designer and back to HTML I now see <table><tbody><tr><td></td></tr></tbody></table>. 

Is is possible to force RadEditor to not fix the HTML for me?

Thanks for your help!

5 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 09 Mar 2011, 04:50 PM
Hello David,

It is not supported by the Rich Text Editing engine of the browser to have only an opening <div> or another tag or only a closing </div> tag in the content area. Every HTML tag is a node in the DOM and it should have an opening and closing tag, in other case the content will be invalid HTML/XHTML.

The browser's Rich Text Editing engine checks for unclosed and non well formed tags and corrects or try to correct them automatically without providing a way to disable the browser validation. You can verify my words by testing the attached HTML page with an editable IFRAME element in it. You will reproduce the same behavior with an editable DIV element as well as in our competitors' editors.

Best regards,
Rumen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
JDs
Top achievements
Rank 1
answered on 26 Aug 2015, 05:40 PM
Are non well formed tags and html still not able to go uncorrected? The html fully gets changed if one thing in the html is incorrect and forces us to figure out what our html was before the editor "attempted" to fix the non well formed html.
0
Ianko
Telerik team
answered on 28 Aug 2015, 07:29 AM
Hello,

As Rumen has explained in his post, the functionality that corrects malformed HTML is a browser technology which is not optional and cannot be disabled.

RadEditor has nothing to do with that logic and therefore, it cannot control it.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matt
Top achievements
Rank 1
answered on 30 Jul 2018, 09:32 PM
True but often I'm forced to create a work-around for something that doesn't work right in Telerik controls... suggest you do the same (adjust to deal with something you can't change).
0
Rumen
Telerik team
answered on 31 Jul 2018, 08:33 AM
Hi Matt,

The web development is a very dynamically changing environment. Almost each month the browser vendors release updates and sometimes major, which often breaks existing properly working functionality and adds regressions in the controls.

In this fast changing world, we are always striving to provide the best suggestions, workarounds and fixes that are currently available.

For the concrete situation, there isn't much to do since this behavior is not only controlled by the underlying rich text editing engine of the browser, but if you leave some tags unclosed, this won't be a valid HTML/XHTML/HTML5 and we will receive complaints for that the editor does not correct the content, which is one of its top features - see the Built-in Content Filters article.

I hope that I delivered clarification on this topic.

Best regards,
Rumen
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.
Tags
Editor
Asked by
David Kalsbeek
Top achievements
Rank 1
Answers by
Rumen
Telerik team
JDs
Top achievements
Rank 1
Ianko
Telerik team
Matt
Top achievements
Rank 1
Share this question
or