Opened 5 years ago

Last modified 2 years ago

#11392 assigned Bug

br tags are removed when switching to source an back.

Reported by: Jakub Ś Owned by: kkrzton
Priority: Nice to have (we want to work on it) Milestone:
Component: General Version: 4.1.2
Keywords: Cc: Chris Wells, timothy.marsh@…, shashank@…

Description (last modified by Jakub Ś)

This is the continuation of #10146 issue.

Problems can be reproduced in all browsers and don't occur in CKEditor 3.x

Examples:


Two brs are handled the same way as one br

Both code snippets

<br>
<br>
<p>This is a paragraph of text.</p>

and

<br>
<p>This is a paragraph of text.</p>

will result into:

&nbsp;
<p>This is a paragraph of text.</p>

This

    <br /> 
    <br /> 
    <p>This is a paragraph of text.</p> 
    <br /> 
    <br /> 
    <p>Second paragraph of text.</p>

results in

&nbsp;
<p>This is a paragraph of text.</p>
&nbsp;

<p>Second paragraph of text.</p>

One br is chnaged into &nbsp;

This

<table>
	<tbody>
		<tr>
			<td>Table cell contents</td>
		</tr>
	</tbody>
</table>
<br>
<p>P contents</p>

will result in

<table>
	<tbody>
		<tr>
			<td>Table cell contents</td>
		</tr>
	</tbody>
</table>
&nbsp;
<p>P contents</p>

I understand that fix for #10146 has introduced fix which changes last BR into &nbsp and most likely example two is a "won't fix". Another reason for this may be that nbsp; in second example creates in fact new line.
The only problem with example two I see is that code is in fact different to what user has entered and this doesn't occur in CKE 3.x.

Example one is rather a bug and there should be some difference between how one and two BRs are handled.


EDIT: This ticket is the follow up to #10146. Most scenarios from #10146 were fixed. Examples mentioned in this ticket are still live. When fixing this issue, please have older test cases from #10146 in mind so that they didn't get broken again.

There is a workaround mentioned in http://dev.ckeditor.com/ticket/10146#comment:34. It actually handles all the cases but one. When there is no other way to fix it perhaps some smarter way of using that hack could be implemented?

Change History (14)

comment:1 Changed 5 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 5 years ago by Chris Wells

Cc: Chris Wells added

comment:3 Changed 5 years ago by Timothy Marsh

Cc: timothy.marsh@… added

comment:4 Changed 5 years ago by Jakub Ś

Other issues that seem to be related to this one: #10431, #10497, #12209.

comment:5 Changed 4 years ago by Shashank Soni

Cc: shashank@… added

comment:6 Changed 4 years ago by Jakub Ś

Summary: ENTER_MODE_BR - br tags are removed when switching to source an back.br tags are removed when switching to source an back.

comment:7 Changed 4 years ago by Jakub Ś

#13458 was marked as duplicate.

Perhaps methods mentioned in http://dev.ckeditor.com/ticket/10146#comment:21 could be changed to handle these cases.

comment:8 Changed 2 years ago by sudeepvs

Hello, Can you please let us know when would a fix be provided for this issue?

comment:9 Changed 2 years ago by Jakub Ś

@sudeepvs have you tried workaround mentioned in http://dev.ckeditor.com/ticket/10146#comment:34? From what I have checked it works for all the cases but one.

comment:10 Changed 2 years ago by Marek Lewandowski

Priority: NormalNice to have (we want to work on it)

Let's see what we can do about it.

comment:11 Changed 2 years ago by Jakub Ś

Description: modified (diff)

comment:12 Changed 2 years ago by kkrzton

Owner: set to kkrzton
Status: confirmedassigned

comment:13 Changed 2 years ago by kkrzton

I assume that case one is a bug (treating two br's same as one) and it should be fixed. Behaviour in case two (with tables) should not be changed as replacing last br (in a group of br's) with &nbsp; is a feature (http://dev.ckeditor.com/ticket/10146#comment:20) and should not be changed.

comment:14 Changed 2 years ago by kkrzton

One br is always removed in cleanBogus function. I also checked how it will behave for more br's, like

<br>
<br>
<br>
<p>This is a paragraph of text.</p>

and cleanBogus behaves the same (removing one br), but then the br is added back in filterChildren function (which not happens for 2 br's only). Not yet sure what is the reason for such behaviour.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy