Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#8404 closed Bug (invalid)

Paste as plain text not working correctly with content from Word that includes blank lines

Reported by: Teresa Monahan Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version: 3.1
Keywords: IBM Cc: Damian, Satya Minnekanti

Description

When text content in Word contains blank lines and it is pasted into CKEditor as plain text, some of the blank lines are removed. This seems to happen across all browsers - I have tested FF, IE and Chrome.

To reproduce, enter the following content in Word. Note: There are 2 blank lines between 'aaaa' and 'bbbb' and one blank line between the remaining content.

aaaa


bbbb

cccc

dddd

Now copy this content from Word and paste in into CKEditor using the 'Paste as Plain Text' dialog.

Problem: Some of the blank lines have been removed in CKEditor. There is now only one blank line between 'aaaa' and 'bbbb', and there are no blank lines in the remainder of the content.

The HTML generated for this content is:

<p>
	aaaa</p>
<p>
	<br />
	bbbb</p>
<p>
	cccc</p>
<p>
	dddd</p>

Note: This is the same markup that is generated for a slightly different usecase in ticket #8403, so the 2 issues may be related.

Change History (5)

comment:1 Changed 13 years ago by Jakub Ś

Status: newconfirmed
Version: 3.6.23.1

It seems that form CKEditor 3.1 when pasting contents as plain text - empty lines are lost.

The same thing happens when we paste TC content taken from Notepad.

comment:2 Changed 13 years ago by Garry Yao

Resolution: invalid
Status: confirmedclosed

The rule with plain text pasting is to convert to two consequent line breaks into a paragraph, the rest of single is established as a <BR>, so at least not a bug here.

comment:3 in reply to:  2 Changed 13 years ago by Teresa Monahan

Replying to garry.yao:

The rule with plain text pasting is to convert to two consequent line breaks into a paragraph, the rest of single is established as a <BR>, so at least not a bug here.


Can you explain why this rule is applied? It seems like incorrect behavior since the removal of blank lines is technically data loss for the user.

Ticket #7622 describes the same issue for the Paste operation. It explains that in that case the loss of line breaks is due to browser processing but suggests 'Paste as plain text' as a workaround. However as described here, line breaks are removed when pasted as plain text too.

If the line breaks are used to identify where paragraph tags should be added, would it be possible to also add <br /> &nbsp; before the closing p tag so that the line breaks would be preserved i.e the html generated for the data in this ticket would then be:

<p>
	aaaa<br />
	&nbsp;</p>
<p>
	<br />
	bbbb<br />
	&nbsp;</p>
<p>
	cccc<br />
	&nbsp;</p>
<p>
	dddd</p>

This is a customer reported issue so it is a high priority for us. Can you please reopen this ticket and investigate it further?

comment:4 Changed 13 years ago by Frederico Caldeira Knabben

The Paste as Plain text feature has been designed in a way that it optimizes the pasting operation, to avoid having the user to reformat the text after paste.

When creating text documents, it is very common to have empty lines separating paragraphs, using single line-breaks for soft-breaks, simulating SHIFT+ENTER. Something like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at nisl nec
est suscipit faucibus. Mauris diam lectus:
http://ckeditor.com

Proin aliquet neque sit amet felis egestas vestibulum. Fusce viverra volutpat
justo, non sodales metus ultrices nec. Fusce molestie feugiat odio eu aliquam.
Vestibulum sed erat vel justo fringilla pulvinar. Nunc ipsum sapien, suscipit
et ullamcorper faucibus, laoreet non leo. Morbi porttitor auctor justo, sed
lacinia sem luctus sit amet. Nunc aliquet velit eu urna posuere et molestie
purus condimentum. Integer vitae libero tristique dolor semper imperdiet id
eget turpis. Nullam fringilla dapibus aliquam. In mollis viverra ligula, eu
adipiscing felis mattis aliquet.

Donec in arcu nunc, et dignissim lacus. Duis a erat sem. Nam a cursus diam.
Nam tristique lacus ut ligula malesuada elementum. Etiam dictum ante molestie
nisl blandit tempor. Integer eget tortor non magna sodales feugiat sit amet
non lectus. Aliquam erat volutpat. Phasellus nec augue vitae quam ullamcorper
molestie. Aenean eu hendrerit odio.

So, for the above, instead of having BRs separating each paragraph, we instead automate this, creating the proper Ps. For the user, this happens transparently and it is even expected.

Then, we have Word as a problem. The thing is that Word doesn't separate paragraphs with line spaces when converting to plain text. Because of this, we have all paragraphs together.

A problem with this is that, for example, it is not possible to differentiate ENTER and SHIFT+ENTER for plain text converted Word documents.

Our decision must be so based on the average use case. Considering that the auto <p> feature is desired and that is uncommon to have MS Word documents with empty lines to be inserted in CKEditor, I would say that we should keep the current behavior.

Of course, we could think about enhancements to this. I've just opened #8834, which could be an important step forward in that sense.

comment:5 Changed 11 years ago by Frederico Caldeira Knabben

Component: Core : PastingPlugin : Paste from Word
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy