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

NewLine formatting issue

6 Answers 197 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 17 Apr 2019, 01:36 PM

Hi,

 

When I have content in the editor like:

 

<div class="container">
<div class="row">
aaaaa
</div>
</div>

Adding " bbbb cccc" in Design mode and give Enter after aaaa would result in the following HTML:

<div class="container">
<div class="row">
aaaaa </div>
<div class="row">
bbbb ccccc
</div>
</div>

So the div tag is splitted up. We think it would be logical to do the split and add a <p> tag around the content of the new div so the text paddings are right like so:

 

<div class="container">
<div class="row">
aaaaa </div>
<div class="row">
<p>bbbb ccccc</p>
</div>
</div>

Of course this would only happen when NewLineMode is in default (paragraph) position

Any thoughts?

Marc

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Apr 2019, 03:38 PM
Hi Marc,

Please excuse us for the inconvenience this behavior is causing!

This is a known side effect of the NewLineMode="P" functionality and you can vote for its improvement at https://feedback.telerik.com/aspnet-ajax/1377072-new-post-in-insertparagraph-inserts-div-tag-when-newlinemode-div-and-should-insert-p-tag

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.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 01 May 2019, 01:16 PM

Hi Rumen,

 

Thanks for looking into this issue.

 

I did some more testing and found some other issues:

When setting NewLineMode to Br, here is stated:

 

https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/control-new-line-behavior

That Ctrl+M would insert a new paragraph which it doesn't.

Furthermore when I am in a DIV then the DIV is splitted up, where I would expect that it just would insert the BR tags in the DIV's content.

BR, Marc

0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 01 May 2019, 01:42 PM

Sorry for not being clear on the last issue:

Furthermore when I am in a DIV then the DIV is splitted up, where I
would expect that it just would insert the P tag in the DIV's content.

 

This happens when I use the Insert Paragraph button when in NewLineMode = Br

Marc

0
Rumen
Telerik team
answered on 06 May 2019, 09:51 AM
Hello Marc,

Here is an example of how to customize the built-in behavior of the InsertParagraph command, e.g. when the cursor inside a div and the InsertParagraph button is pressed, a paragraph will be inserted in the div:

<script type="text/javascript">
function OnClientCommandExecuting(editor, args)
{
    if("InsertParagraph" == args.get_commandName())
    {
        editor.pasteHtml('<p> <span id="_reSelectionMarker"></p>');
 
        var marker = editor.findContent("#_reSelectionMarker").get(0); //get the marker
 
        var range = editor.getDomRange();
        range.selectNodeContents(marker);//Select the entire contents of the element with the range
        range.collapse(false);//false means collapse to end rather than the start
        range.select();//Select the range (make it the visible selection
        marker.parentNode.removeChild(marker); //remove the marker
        args.set_cancel(true);
    }
}
</script>
<telerik:radeditor runat="server" ID="RadEditor1" NewLineMode="P" OnClientCommandExecuting="OnClientCommandExecuting">
    <Content>
        <div>test</div>
    </Content>
</telerik:radeditor>


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.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 06 May 2019, 11:21 AM

Thank you Rumen, this is very helpful.

 

Marc

0
Rumen
Telerik team
answered on 06 May 2019, 12:27 PM
You are welcome, Marc!

For reference I also copied the solution in the bug report item, since it might be useful to somebody else:

New post in InsertParagraph inserts div tag when NewLineMode=DIV and should insert p tag.

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
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Rumen
Telerik team
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or