Skip to content

Commit

Permalink
Merge branch 't/16866' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Tade0 committed Feb 24, 2017
2 parents 74adb86 + 4fd708a commit 2b6de50
Show file tree
Hide file tree
Showing 206 changed files with 35,311 additions and 6,522 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ New Features:

Fixed Issues:

* [#16866](http://dev.ckeditor.com/ticket/16866): [IE, Edge] Fixed: Whitespaces not preserved when pasting from Word.
* [#16860](http://dev.ckeditor.com/ticket/16860): Fixed: Paragraphs which only look like lists wrongly transformed into them when pasting from Word.
* [#16817](http://dev.ckeditor.com/ticket/16817): Fixed: Paragraph transformed into lists, with corrupted data when pasting from Word.
* [#16833](http://dev.ckeditor.com/ticket/16833): [IE11] Fixed: Malformed list with headers [pasted from Word](http://ckeditor.com/addon/pastefromword).
Expand Down
55 changes: 48 additions & 7 deletions plugins/pastefromword/filter/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
}

if ( List.thisIsAListItem( editor, element ) ) {
if ( Heuristics.isEdgeListItem( editor, element ) ) {
Heuristics.cleanupEdgeListItem( element );
}

List.convertToFakeListItem( editor, element );

// IE pastes nested paragraphs in list items, which is different from other browsers. (#16826)
Expand Down Expand Up @@ -254,6 +258,12 @@
return false;
}

if ( element.attributes.style.match( /FONT-FAMILY:\s*Symbol/i ) ) {
element.forEach( function( node ) {
node.value = node.value.replace( / /g, '' );
}, CKEDITOR.NODE_TEXT, true );
}

Style.createStyleStack( element, filter, editor );
},
'table': function( element ) {
Expand Down Expand Up @@ -387,11 +397,18 @@
}
return false;
},
text: function( content ) {
text: function( content, node ) {
if ( inComment ) {
return '';
}
return content.replace( / /g, ' ' );

var grandparent = node.parent && node.parent.parent;

if ( grandparent && grandparent.attributes && grandparent.attributes.style && grandparent.attributes.style.match( /mso-list:\s*ignore/i ) ) {
return content.replace( / /g, ' ' );
}

return content;
}
} );

Expand Down Expand Up @@ -529,8 +546,8 @@
* @member CKEDITOR.plugins.pastefromword.styles
*/
createStyleStack: function( element, filter, editor ) {
var i,
children = [];
var children = [],
i;

element.filterChildren( filter );

Expand Down Expand Up @@ -756,7 +773,7 @@
return;
}

element.attributes[ 'cke-symbol' ] = symbol.replace( / .*$/, '' );
element.attributes[ 'cke-symbol' ] = symbol.replace( /(?: | ).*$/, '' );

List.removeSymbolText( element );
}
Expand Down Expand Up @@ -1017,7 +1034,7 @@

// Taking into account cases like "1.1.2." etc. - get the last element.
getSubsectionSymbol: function( symbol ) {
return ( symbol.match( /([\da-zA-Z]+).?$/ ) || [ 'placeholder', 1 ] )[ 1 ];
return ( symbol.match( /([\da-zA-Z]+).?$/ ) || [ 'placeholder', '1' ] )[ 1 ];
},

setListDir: function( list ) {
Expand Down Expand Up @@ -1703,13 +1720,37 @@
innerText += text.value;
}, CKEDITOR.NODE_TEXT );

if ( innerText.match( /^( )*\(?[a-zA-Z0-9]+?[\.\)] ( ){2,}/ ) ) {
if ( innerText.match( /^(?: | )*\(?[a-zA-Z0-9]+?[\.\)](?: | ){2,}/ ) ) {
return true;
}

return Heuristics.isDegenerateListItem( editor, item );
},

/**
* Cleans up given list `item`. It's needed to remove Edge pre marker indentation, since edge pastes
* list items as plain paragraphs with multiple ` `s before the list marker.
*
* @since 4.7.0
* @param {CKEDITOR.htmlParser.element} item The pre-processed list-like item, like a paragraph.
* @member CKEDITOR.plugins.pastefromword.heuristics
* @private
*/
cleanupEdgeListItem: function( item ) {
var textOccurred = false;

item.forEach( function( node ) {
if ( !textOccurred ) {
node.value = node.value.replace( /^(?: |[\s])+/, '' );

// If there's any remaining text beside nbsp it means that we can stop filtering.
if ( node.value.length ) {
textOccurred = true;
}
}
}, CKEDITOR.NODE_TEXT );
},

/**
* Check whether an element is a degenerate list item.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -32,7 +32,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -55,7 +55,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -78,7 +78,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -101,7 +101,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -124,7 +124,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -147,7 +147,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -32,7 +32,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -55,7 +55,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -78,7 +78,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -93,6 +93,13 @@
<p style="margin:0px 0px 0px 144px">
<span style="margin:0px">
<span style="margin:0px">
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
<font color="#000000">
<font face="calibri">
<font size="3">i.</font>
Expand All @@ -101,7 +108,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -124,7 +131,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -147,7 +154,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -158,4 +165,4 @@
<font size="3">list</font>
</font>
</font>
</p>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
</span>
</li>
</ul>
<p></p>
<p>
<span style="background:white">&nbsp;</span>
</p>
<p>
<span style="background:white">
<b>
Expand All @@ -40,7 +42,9 @@
</b>
</span>
</p>
<p></p>
<p>
<span style="background:white">&nbsp;</span>
</p>
<ul>
<li style="margin:0px">
<span style="font-size:12pt">
Expand Down Expand Up @@ -77,7 +81,11 @@
</span>
</li>
</ul>
<p></p>
<p>
<span style="background:white">
<b>&nbsp;</b>
</span>
</p>
<p>
<span style="background:white">
<b>
Expand Down Expand Up @@ -168,4 +176,4 @@
<span style="font-family:&quot;calibri&quot;,sans-serif">last item</span>
</span>
</span>
</p>
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -91,7 +91,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp; </font>
</span>
</span>
</span>
Expand All @@ -112,7 +112,7 @@
<span style="font:7pt &quot;times new roman&quot;; margin:0px">
<span style="font-size-adjust:none">
<span style="font-stretch:normal">
<font color="#000000"> </font>
<font color="#000000">&nbsp;&nbsp; </font>
</span>
</span>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">this</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">is</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">a</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">one</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;one</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">level</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;level</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">ordered</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ordered</font>
</font>
</font>
</li>
<li style="margin:0px 0px 11px">
<font color="#000000">
<font face="calibri">
<font size="3">list</font>
<font size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list</font>
</font>
</font>
</li>
Expand Down
Loading

0 comments on commit 2b6de50

Please sign in to comment.