Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#10672 closed Bug (duplicate)

Paste from Word not working properly with lists

Reported by: kevin Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version: 3.6.1
Keywords: Cc:

Description

When pasting from Word lists are not nested or indented properly after the first indent. This behaviour can be duplicated in Firefox 18, and Chrome 25.0. In IE the results are even worse. The lists are totally messed up, indented or not. See attached screen shots.

Test Platform Windows 7 Word 2010 IE 8 Chrome 25 Firefox 18

Attachments (2)

ckeditor-paste-from-word.jpg (40.2 KB) - added by kevin 11 years ago.
paste from word screen shot
Lists_Test.docx (13.7 KB) - added by kevin 11 years ago.
Test document for list processing bug.

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by kevin

paste from word screen shot

comment:1 Changed 11 years ago by Jakub Ś

Keywords: paste word removed
Resolution: invalid
Status: newclosed
  1. You have said it yourself "are not nested or indented properly". When you insert invalid code you can expect editor not to present desired result. Because of this I'm closing this ticket as invalid for now.
  1. Could you please send me Word file that is causing this problem? I will have a look at it and tell if this is a bug after all or not.

comment:2 Changed 11 years ago by kevin

The lists follow proper nesting. Having a list nested within another is perfectly valid. The actual lists coming from the clipboard may not be valid, but one of the objectives of the plugin is to clean-up Word's bad HTML, and it would appear that the plugin is doing this but subsequently breaking the list in the postProcessList function. While doing some troubleshooting I commented out line 1150 -- dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor, dataFilter ) );-- in the default.js script that resulted in a correctly formatted list. I will try to explain below.

I captured the following from the clipboard prior to processing by the plugin. as you can see the parent list item of the sub-list is closed off. Word creates separate lists then indents using a style (style="mso-list:l0 level2).

Partial clipboard data.

</xml><![endif]-->

<p class="MsoNormal">Word 2010</p>

<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="mso-list:l0 level1 lfo1">Level <span style="mso-spacerun:yes">&nbsp;</span>1</li>
<li class="MsoNormal" style="mso-list:l0 level1 lfo1">Level 1</li>
<ul style="margin-top:0cm" type="circle">
<li class="MsoNormal" style="mso-list:l0 level2 lfo1">Level 2</li>
<li class="MsoNormal" style="mso-list:l0 level2 lfo1">Level 2</li>
</ul><li class="MsoNormal" style="mso-list:l0 level1 lfo1">Level <span style="mso-spacerun:yes">&nbsp;</span>1</li>
<ul style="margin-top:0cm" type="circle"><li class="MsoNormal" style="mso-list:l0 level2 lfo1">Level <span style="mso-spacerun:yes">&nbsp;</span>2 </li>
<li class="MsoNormal" style="mso-list:l0 level2 lfo1">Level<span style="mso-spacerun:yes">&nbsp; </span>2</li>
</ul><li class="MsoNormal" style="mso-list:l0 level1 lfo1">Level 1</li></ul>

<!--[if gte mso 9]><xml>

Commenting out line 1150 subsequently resulted in a valid list. To recreate simply comment out line 1150

Line 1150 in pastefromword/filter/default.js

// These rules will have higher priorities than default ones.
//comment out below
// dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor, dataFilter ) );

Source output after error - note properly nested lists.

<div>
<p class="MsoNormal">Word 2010</p>

<ul>
	<li class="MsoNormal">Level &nbsp;1</li>
	<li class="MsoNormal">Level 1
	<ul>
		<li class="MsoNormal">Level 2</li>
		<li class="MsoNormal">Level 2</li>
	</ul>
	</li>
	<li class="MsoNormal">Level &nbsp;1
	<ul>
		<li class="MsoNormal">Level &nbsp;2</li>
		<li class="MsoNormal">Level&nbsp; 2</li>
	</ul>
	</li>
	<li class="MsoNormal">Level 1</li>
</ul>
</div>

<p>&nbsp;</p>

Output without causing error - only first list is indented properly:

<div>
<p>Word 2010</p>

<ul>
	<li>Level &nbsp;1</li>
	<li>Level 1
	<ul>
		<li>Level 2</li>
		<li>Level 2</li>
	</ul>
	</li>
	<li>Level &nbsp;1</li>
	<li>Level &nbsp;2</li>
	<li>Level&nbsp; 2</li>
	<li>Level 1</li>
</ul>
</div>

<p>&nbsp;</p>

I have attached the Word document for testing. Also note that TinyMCE is able to handle these lists and produce valid html. I will continue troubleshooting as time permits. If I find a solution I will submit as a pull request on Git-Hub.

Last edited 11 years ago by kevin (previous) (diff)

Changed 11 years ago by kevin

Attachment: Lists_Test.docx added

Test document for list processing bug.

comment:3 Changed 11 years ago by Jakub Ś

Resolution: invalid
Status: closedreopened

comment:4 Changed 11 years ago by Jakub Ś

Component: Core : PastingCore : Lists
Resolution: duplicate
Status: reopenedclosed
Version: 4.23.6.1

I'm sorry for misunderstanding you in the first place.

Your issue is in fact a duplicate of #8103 and can be reproduced in CKEditor version 3.x as well. I will forward it to my supervisor with question if it can be fixed in one of future releases as it seems important.

@mankev If you have any new findings please add them to #8103.

comment:5 Changed 11 years ago by kevin

OK will do.

comment:6 Changed 10 years ago by Frederico Caldeira Knabben

Component: Core : ListsPlugin : 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