diff --git a/CHANGES.md b/CHANGES.md index 7145a8210ca..5f832b81e5f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Fixed Issues: * [#13410](http://dev.ckeditor.com/ticket/13410): Fixed: Error thrown in the [Auto Embed](http://ckeditor.com/addon/autoembed) plugin when undoing right after pasting a link. * [#13143](http://dev.ckeditor.com/ticket/13143): [Edge] Fixed: Focus lost while opening the panel. * [#13494](http://dev.ckeditor.com/ticket/13494): Fixed: Error thrown in toolbar configurator if plugin requirements are unsatisfied. +* [#11376](http://dev.ckeditor.com/ticket/11376): [IE11] Fixed: Loss of text when pasting bullet lists from Microsoft Word. ## CKEditor 4.5.1 diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index 5393fa2ff2a..fd595192102 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -337,8 +337,18 @@ var attributes = child.attributes, listItemChildren = child.children, count = listItemChildren.length, + first = listItemChildren[ 0 ], last = listItemChildren[ count - 1 ]; + // Converts
  • {...}

  • ->
  • {...}
  • . + // The above format is what we got when pasting from Word 2010 to IE11 and possibly some others. + // Existence of extra

    tag that can be later recognized as list item (see #getRules.return.elements.p) + // creates incorrect and problematic structures similar to {...}. (#11376) + if ( first.attributes && first.attributes.style && first.attributes.style.indexOf( 'mso-list' ) > -1 ) { + child.attributes.style = first.attributes.style; + first.replaceWithChildren(); + } + // Move out nested list. if ( last.name in CKEDITOR.dtd.$list ) { element.add( last, i + 1 ); diff --git a/tests/plugins/pastefromword/pastefromword.html b/tests/plugins/pastefromword/pastefromword.html index 68518d694b9..469cffd54f3 100644 --- a/tests/plugins/pastefromword/pastefromword.html +++ b/tests/plugins/pastefromword/pastefromword.html @@ -13,4 +13,18 @@ style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family: Symbol'>ยท      item3

    - \ No newline at end of file + + + + + diff --git a/tests/plugins/pastefromword/pastefromword.js b/tests/plugins/pastefromword/pastefromword.js index 2baab319ff1..f104fa2b72f 100644 --- a/tests/plugins/pastefromword/pastefromword.js +++ b/tests/plugins/pastefromword/pastefromword.js @@ -198,7 +198,23 @@ }, null, true ); + }, + + // #11376 - test pasting a list with a Word 2010 / IE11 output. + 'test paste list on Word 2010 + IE': function() { + if ( !CKEDITOR.env.ie ) { + assert.ignore(); + } + + var editor = this.editors.inline; + + assertPasteEvent( editor, + { dataValue: CKEDITOR.document.getById( 'pastedHtmlList2' ).getValue() }, + function( data ) { + assert.isInnerHtmlMatching( '', data.dataValue ); + }, + null, true + ); } } ); - -} )(); \ No newline at end of file +} )();