Skip to content

Commit

Permalink
Merge branch 't/11976' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun committed Jun 3, 2015
2 parents ebc9132 + ddf3e8a commit 2a4748a
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -34,6 +34,7 @@ Fixed Issues:
* [#13136](http://dev.ckeditor.com/ticket/13136): Fixed: Autocompleter is far too intrusive.
* [#13133](http://dev.ckeditor.com/ticket/13133): Fixed: Tab leaves the editor.
* [#13173](http://dev.ckeditor.com/ticket/13173): Fixed: `config.removeButtons` is ignored by the advanced toolbar configurator.
* [#11976](http://dev.ckeditor.com/ticket/11976): Fixed: Copy&paste and drag&drop lists from MS Word to Chrome.

Other Changes:

Expand Down
9 changes: 9 additions & 0 deletions plugins/pastefromword/filter/default.js
Expand Up @@ -248,6 +248,11 @@
// The best situation: "mso-list:l0 level1 lfo2" tells the belonged list root, list item indentation, etc.
[ ( /^mso-list$/ ), null, function( val ) {
val = val.split( ' ' );
// Ignore values like "mso-list:Ignore". (FF #11976)
if ( val.length < 2 ) {
return;
}

var listId = Number( val[ 0 ].match( /\d+/ ) ),
indent = Number( val[ 1 ].match( /\d+/ ) );

Expand Down Expand Up @@ -1131,6 +1136,10 @@
};

CKEDITOR.cleanWord = function( data, editor ) {
// We get <![if !supportLists]> and <![endif]> when we started using `dataTransfer` instead of pasteBin, so we need to
// change <![if !supportLists]> to <!--[if !supportLists]--> and <![endif]> to <!--[endif]-->.
data = data.replace( /<!\[([^\]]*?)\]>/g, '<!--[$1]-->' );

// Firefox will be confused by those downlevel-revealed IE conditional
// comments, fixing them first( convert it to upperlevel-revealed one ).
// e.g. <![if !vml]>...<![endif]>
Expand Down
16 changes: 16 additions & 0 deletions tests/plugins/pastefromword/pastefromword.html
@@ -0,0 +1,16 @@
<textarea id="pastedHtmlList1" cols="10" rows="10">
<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>item1<o:p></o:p></p>

<p class=MsoListParagraphCxSpMiddle style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>item2<o:p></o:p></p>

<p class=MsoListParagraphCxSpLast style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>item3<o:p></o:p></p>
</textarea>
20 changes: 20 additions & 0 deletions tests/plugins/pastefromword/pastefromword.js
@@ -1,5 +1,8 @@
/* bender-tags: editor,unit,clipboard */
/* bender-ckeditor-plugins: pastefromword */
/* bender-include: ../clipboard/_helpers/pasting.js */

/* global assertPasteEvent */

( function() {
'use strict';
Expand Down Expand Up @@ -178,6 +181,23 @@

wait();
} );
},

// #11976 - lists look differently when HTML is taken directly from the clipboard instead of pastebin.
'test paste list on Webkit, Blink and Gecko': function() {
if ( !( CKEDITOR.env.webkit || CKEDITOR.env.gecko ) ) {
assert.ignore();
}

var editor = this.editors.inline;

assertPasteEvent( editor,
{ dataValue: CKEDITOR.document.getById( 'pastedHtmlList1' ).getValue() },
function( data ) {
assert.isInnerHtmlMatching( '<ul><li>item1</li><li>item2</li><li>item3</li></ul>', data.dataValue );
},
null, true
);
}
} );

Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/10285/1.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: pastefromword,font */

bender.editor = {
Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/11237/1.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: clipboard,pastefromword,ajax */
/* global assertPasteEvent */

Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/8103/1.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: clipboard,pastefromword,ajax */
/* global assertPasteEvent */

Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/9330/1.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: clipboard,pastefromword,ajax */
/* global assertPasteEvent */

Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/9456/1.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: clipboard,pastefromword,format,ajax */
/* global assertPasteEvent */

Expand Down
2 changes: 1 addition & 1 deletion tests/tickets/9456/2.js
@@ -1,4 +1,4 @@
/* bender-tags: editor,unit,pastefromword */
/* bender-tags: editor,unit,clipboard,pastefromword */
/* bender-ckeditor-plugins: clipboard,pastefromword,format,ajax,basicstyles */
/* global assertPasteEvent */

Expand Down

0 comments on commit 2a4748a

Please sign in to comment.