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

Generate bullets not working correctly

12 Answers 357 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Steeve
Top achievements
Rank 1
Steeve asked on 11 Feb 2014, 03:06 PM

Hi,

My client want the option to have bullets in her text.  But when she select a part of text and click on "InsertUnorderedList", only one bullet is generated at the beginning of the text (for the entire paragraph).

This behavior is also reproduced in your examples (and this editor).
http://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx

If the copy/paste this text:
The services provided included <br>studies, <br>detailed design and complete project management services, <br>including specifications, <br>tender documents, <br>procurement, <br>inspection, <br>construction supervision <br>commissioning.

and I select some lines and I click on "InsertUnorderedList", I have the following result:
<ul><li>The services provided included <br>studies, <br>detailed design and complete project management services, <br>including specifications, <br>tender documents, <br>procurement, <br>inspection, <br>construction supervision <br>commissioning.</li></ul>

My example is attached to this thread.

So, I want to generate bullets only for the selected text (or for the line where the cursor is located)

Thank you

Steeve

12 Answers, 1 is accepted

Sort by
0
Steeve
Top achievements
Rank 1
answered on 11 Feb 2014, 04:31 PM
Hi,

I forgot to you mention that i'm working with the version 2013.3.1217.40.

Thank you

Steeve
0
Christian
Top achievements
Rank 1
answered on 11 Feb 2014, 05:31 PM
A client of ours just pointed out this issue to us.We are using version 2013.3.1211.35

It only happens when we try to select text and apply the bullets or numbers to the selected text.
0
Marin Bratanov
Telerik team
answered on 12 Feb 2014, 09:42 AM
Hi guys,

This is not a bug, but an intentional change in the control that is described in detail here: http://www.telerik.com/help/aspnet-ajax/editor-inline-and-block-commands-behavior-change.html.

Essentially, we are trying to make the RadEditor experience closer to that of desktop rich text editors (like MS Word) and they create lists out of block elements only. Thus, you should set the NewLineMode property to P to get the same behavior because it defaults to a line break.
If you insert a line break in MS Word (ctrl+enter) you will see that it does not become a separate bullet.

Thus, you may also find interesting this poll so you can leave your comment and cast your vote: http://feedback.telerik.com/Project/108/Feedback/Details/53978-poll-the-default-value-of-the-newlinemode-property-in-radeditor-should-be-p.

The article I linked in the beginning also shows how you can get the obsolete commands back if you like, but note that they are no longer supported and we cannot guarantee there will be no issues with them, especially in modern browsers like IE11.


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Christian
Top achievements
Rank 1
answered on 20 Feb 2014, 07:33 PM
Thank you for the reply Marin.

Actually, I don't see how this is bringing consistency to this feature.

Try this example:
1. Go into notepad and create a simple list of 3 lines (bullet 1, bullet 2, bullet 3)
2. Next paste this example into MS Word
3. Highlight the selection and apply bullets to the short list

The whole thing works as expected and you get 3 bulleted lines.

Now try the same thing in your editor.  You get a funky bullet, but not they way you can in Word.  It did not use to do it this way and I get the same results if NewLineMode is Br or P.

Thank you,
Christian
0
Marin Bratanov
Telerik team
answered on 21 Feb 2014, 11:51 AM
Hello Christian,

This boils down to how each application considers new lines.
Here is what happens in the case you described:
1. Notepad has only one type of line breaks and no actual concept of paragraphs (it is simple text editing tool)
2. pasting into word, however, generates paragraphs, because this is how MS Word operates, so you can get a list item per paragraph (that used to be a line in notepad)
3. pasting in the browser causes the browser to determine what flavor the data has, and since it comes as plain text, it produces line breaks (<br /> tags), and this is what the browser sends to our code (RadEditor).

You can confirm this logic in the attached video that explains the MS Word behavior and shows what HTML is pasted in a simple editable frame.


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Christian
Top achievements
Rank 1
answered on 21 Feb 2014, 12:20 PM
Marin,

Thank you again for the reply.

Despite all your explanations I still can't get back to the old way unless I revert to an older .js file (supposedly).  The dilemma we and other of your clients face is that we have to explain this to our clients.  There is no way that is going to happen using your explanation.  Our average client user is not that technical and probably does not care.  They just want it to work.

The fact that you have all this transitional help means that you expected problems with this issue.  Why in the world haven't you given your clients a better work-around then "this is the way we are doing it now".  The issue is with the paste.  Why not have a way to convert to the paragraph tag for pasted or existing text in my case.  There is no such toolbar item like this that i am aware of.

This is extremely frustrating since I have to spend time with the client finding a work-around for something that used to work. I think Telerik has handled this badly.  My clients have to wait until we figure something out, and then they have to wait for our release cycle since we do not deploy on a whim.

Thank you,
Christian
0
Marin Bratanov
Telerik team
answered on 24 Feb 2014, 04:14 PM
Hello Christian,

Software has to evolve in order to match the expectations and provide better experience for the majority of our clients. Getting the behavior closer to that of MS Word has been requested very often and we have heeded this request.

We are aware of the fact that there will always be people who prefer the old behavior and that some users may not be content with the new way, which is why we extract old commands and offer this file - so that developers can revert to the old commands for the old behavior, should they choose to.

Thus, it will, perhaps, be your option of choice in this matter.

Setting thew NewLineMode to P will have your users using the control as before, but with more semantic content and with the way MS Word behaves.

On pasting - there are various ways to handle this and our priority is to not modify the content the browser-user-other software combination provides. We cannot know all possible combinations, requests, desires and preferences, which is why we apply as little modifications as possible. If paragraphs come in from MS Word, paragraphs will be pasted. If line breaks come in - line breaks it is.

If a user pastes line breaks into MS Word they will not be able to create lists as it is, and they would need to go and press enter before each line they want to make a separate list item. If NewLineMode=P in RadEditor, the same process will yield paragraphs and lists will be created as in MS Word.

This is why the OnClientPasteHtml event exists - so developers can customize the content before it enters RadEditor. Here is a small example that will convert break tags to paragraphs:

<telerik:RadEditor ID="RadEditor1" runat="server" OnClientPasteHtml="replaceBreaks">
</telerik:RadEditor>
<script type="text/javascript">
    function replaceBreaks(sender, args)
    {
        var updatedContent = "";
        if (args.get_value().indexOf("<br") > -1)
        {
            updatedContent = args.get_value().replace(/<br\s*[\/]?>/gi, "</p><p>");
            updatedContent = "<p>" + updatedContent + "</p>";
            args.set_value(updatedContent);
        }
    }
</script>

and you can extend this further to match your needs if you like.

With all this we have offered improved experience for the majority of people while leaving a number of options for the rest. This is more than most breaking changes in software offer as alternatives, for example AjaxControlToolkit's script manager incompatibility. We do care for our clients and we try to make transitions as easy as possible.

Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Steeve
Top achievements
Rank 1
answered on 17 Mar 2014, 03:22 PM
Hi Marin,

I update telerik to version 2013.3.1217.40 and set NewLineMode property to P and it works well.

Thanks for your time!

Steeve
0
Marin Bratanov
Telerik team
answered on 17 Mar 2014, 04:22 PM

Hi Steeve,

It is good to hear this works well for you. In this case, I would like to bring to your attention this poll: http://feedback.telerik.com/Project/108/Feedback/Details/53978-poll-the-default-value-of-the-newlinemode-property-in-radeditor-should-be-p.


Regards,

Marin Bratanov
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
gaurav
Top achievements
Rank 1
answered on 03 Jan 2015, 01:02 PM
Unable to solve this issue not generate  bullet list on whole item.
0
Fakhrulhilal
Top achievements
Rank 1
answered on 21 Mar 2019, 09:33 AM

Hi Marin,

I know by setting NewLineMode will resolve the problem. But this brings dilemma. We choose Br because it doesn't create space (margin) between line. I know we can hack it by set CSS margin to zero for P. But this will bring new dilemma as well. We can't distinguish between new line and paragraph. 

The original expectation:
1. If a line is blocked, then only blocked line will be brought to numbered/bulleted
2. If no line blocked, then current paragraph will be brought to numbered/bulleted
Is that possible to bring it back?

0
Marin Bratanov
Telerik team
answered on 22 Mar 2019, 02:05 PM
Hello,

You can get the old commands back by following the last section of the documentation article that describes the change: https://docs.telerik.com/devtools/aspnet-ajax/controls/editor/changes-and-backwards-compatibility/inline-and-block-commands-behavior-change#how-to-get-the-old-behavior-back. I must note that this is code from around 2013 and is likely to revert a lot of other improvements we have made and bugs we have fixed, so you should use it at your own discretion and risk.

The current behavior does exactly what you describe - if the cursor is in a block element, only that element will be added to the bullet. Otherwise, the nearest block will be made into a list. A single line of text cannot be a block element on its own and as such - it could have never been made into a bullet on its own without regard for block elements. The old set of commands did have similar behavior to an extent, because they didn't take into account block elements at all. This is not a feature, bug a bug, however.

Distinguishing between paragraphs and line breaks is both semantic, and in terms of appearance. If you alter the appearance of the paragraphs, you can still tell one from the other through their HTML string.


Regards,
Marin Bratanov
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
Steeve
Top achievements
Rank 1
Answers by
Steeve
Top achievements
Rank 1
Christian
Top achievements
Rank 1
Marin Bratanov
Telerik team
gaurav
Top achievements
Rank 1
Fakhrulhilal
Top achievements
Rank 1
Share this question
or