#8103 closed Bug (fixed)
Problems when pasting lists from word
Reported by: | Jakub Ś | Owned by: | Piotrek Koszuliński |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.2.1 |
Component: | Core : Lists | Version: | 3.6.1 |
Keywords: | Cc: | satya_minnekanti@…, john.barreiros@… |
Description (last modified by )
This issue was found when reproducing #7982
- Paste the list from the attached file to CKEditor
- The last second-level list items will be changed to first-level list items.
The file contains description how this list was created in WORD.
Pasting such lists worked till version 3.6.
From revision [6912] it got broken. All elements were pasted as first level list-items.
In rev [6977] there was a slight improvement. Items after first sub-list weren't pasted.
From rev [7008] it works as described above.
Attachments (2)
Change History (16)
Changed 14 years ago by
comment:1 Changed 14 years ago by
Status: | new → confirmed |
---|
comment:2 Changed 14 years ago by
Cc: | satya_minnekanti@… added |
---|
Changed 13 years ago by
Attachment: | nested-list-test.doc added |
---|
comment:3 Changed 13 years ago by
comment:4 Changed 13 years ago by
Possible duplicate was reported in #8754
Revisions are the same but the issue is reproducible in Firefox, when copying/pasting HTML and only with PasteFromWord.
comment:5 Changed 11 years ago by
Cc: | john.barreiros@… added |
---|
I finally got around to upgrading from 3.6 to 3.6.6.1 and unfortunately this is still an issue.
I dug into the code -- plugins/pastefromword/filter/default.js -- and I think the following is the problem:
In the flattenList() function, the variable children is set to element.children. When a sublist is processed, children gets set to an array. On the next for-loop iteration, the children variable does not have the expected values.
The fix is to reset children to element.children.
var children = element.children, child; for ( var i = 0; i < children.length; i++ ) { child = children[ i ]; if ( child.name in CKEDITOR.dtd.$listItem ) { ... } // Flatten sub list. else if ( child.name in CKEDITOR.dtd.$list ) { // Absorb sub list children. arguments.callee.apply( this, [ child, level + 1 ] ); children = children.slice( 0, i ).concat( child.children ).concat( children.slice( i + 1 ) ); element.children = []; for ( var j = 0, num = children.length; j < num ; j++ ) element.add( children[ j ] ); // BUGFIX: above, children set to an array, reset to reference element.children children = element.children; } }
I hope that helps.
comment:7 Changed 11 years ago by
Milestone: | → CKEditor 4.2.1 |
---|
Thanks jorp. We gonna check this.
I'm tentatively targeting this ticket to the next release.
comment:8 Changed 11 years ago by
I am having this exact same issue as well. I hope it gets resolved soon, because my users will be creating many outlines and lists.
comment:9 Changed 11 years ago by
Owner: | set to Piotrek Koszuliński |
---|---|
Status: | confirmed → assigned |
comment:10 Changed 11 years ago by
Status: | assigned → review |
---|
Pushed t/8103 on dev and tests.
Note for a reviewer: 3rd level of lists indetation does not work (at least on Webkit), but this is a different issue, caused by the fact that 3rd level is hoisted by browser/MSWord from list structure to normal paragraphs.
@jorp: Thanks for this patch.
comment:11 Changed 11 years ago by
Status: | review → review_passed |
---|
I have checked branch t/8103 and it seems to work fine.
The only thing that doesn't work are these 3-rd level lists on webkit (although Safari 5.1 wors as expected).
comment:12 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Fixed on master with git:acaffaa and a21a00a on tests.
comment:13 Changed 10 years ago by
i am using CKeditor 4.4,4 but still i am facing the same issue please help us to resolve it
comment:14 Changed 10 years ago by
I have checked this in Webkit and Blink browsers on Windows and Mac but everything seems to be fine. I have tested this issue with lists in attachment.
- Please attach docx file with list that is causing problems for you
- Please tell in which browser and which Operating System does it happen
- Perhaps you are using some third-party plugins that influence this behaviour? Does it happen on demo page or with standard/full pre-set downloaded from our page?
#8450 was marked as duplicate