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

RadEditor Newline Mode <div> and <p> inheriting previous class, inserting blocks after

2 Answers 51 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 08 Feb 2017, 07:58 PM

I've done some considerable searching and experimentation on newline mode. I understand that newlinemode.br or .div are necessary for formatting, alignment, etc. However, .div and .p produce some undesirable results. Both in your online demo and in my dev site.

Take the following simple example in html mode

<div class="im-a-div">
put your cursor after me and press enter 3-4 times

</div>

Switch to design mode and press enter 3 or 4 times.

The result looks like this:

<div class="im-a-div">
dddd
</div>
<p class="im-a-div">&nbsp;</p>
<p class="im-a-div">&nbsp;</p>
<p class="im-a-div">&nbsp;</p>
<p class="im-a-div">&nbsp;</p>

Is there some sort of custom filter, or override that I could apply to the newline that would prevent the classes from being applied to these new block elements - and allow them to be inserted inside the <div> that I had intended to work inside? These new <p>'s aren't even inside the div that I was working inside of, and are being placed afterward.

Ideally, the resulting html should look something like

<div class="im-a-div">

<p>nbsp;</p>
<p>nbsp;</p>
<p>nbsp;</p>

</div>

2 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 15 Feb 2017, 02:33 PM
I know you guys are busy, any ideas?
0
Rumen
Telerik team
answered on 15 Feb 2017, 03:46 PM

Hello Mark,

This is a browser behavior which can be reproduced not only in RadEditor competitor web editors but also in a standard editable div/iframe element.

If you'd like you can try to customize the behavior of the enter key by attaching your own function with custom logic to the OnClientCommandExecuted event property of RadEditor and checking for EnterNewLine command execution.

Regards,
Rumen
Telerik by Progress
 
Learn how the Telerik controls can be SharePoint 2007/2010 from this resource. To watch them in action, explore our online SharePoint 2010 and SharePoint 2007 demo sites.
Tags
WebParts for SharePoint
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or