Cannot align middle line without moving all paragraph

Problem

A very common problem is reported that "If you type in a few lines, double click to select the line in the middle, Align to the right, it's aligning all text to the right, not the selected one. As shown in the following screenshot, where the user wanted to right align only the middle line, but the whole block of text has been moved to the right.

problem-example

Solution

By default, the editor uses Line Break <br /> when you use the Enter Key, So, applying the Alignment, the editor applies the alignment on the paragraph, and that's why the whole paragraph is moving. But, you can get your expected behavior by changing the EnterKeyResponse property. Here is a screenshot that shows how you can change the EnterKeyResponse property to "Paragraph".

enter-key-response-setting

Now, if you run the application and create 3 lines using Enter Key, and then select the middle line and apply Right Alignment, you will see that only the middle line is aligned as expected.

paragraph-mode-alignment

So, what if you want both Line Break feature and Partial Alignment at the same time?

It will not be easy/possible to get to a new paragraph when the Enter Key Response is Line Break. But, it can be easy to get Line Break when you use Enter Key Response = Paragraph.

So, it is suggested using the "Paragraph" mode instead of Line Break mode for "EnterKeyResponse".

In order to get Line Break when the EnterKeyResponse = Paragraph, the user can use SHIFT + ENTER. Hitting SHIFT + ENTER key combination will create a regular Line break. And that mode is common even in MS Word. So, it will be a good idea to use the Paragraph mode all the time.

Last updated on Apr 3, 2020