Bladeren bron

Merge branch 't/49' of git://github.com/kobsy/ckeditor5-paste-from-office into kobsy-t/49

Krzysztof Krztoń 6 jaren geleden
bovenliggende
commit
6cc501f604

+ 1 - 0
packages/ckeditor5-paste-from-office/src/filters/space.js

@@ -20,6 +20,7 @@ export function normalizeSpacing( htmlString ) {
 	return normalizeSafariSpaceSpans( normalizeSafariSpaceSpans( htmlString ) ) // Run normalization two times to cover nested spans.
 		.replace( / <\//g, '\u00A0</' )
 		.replace( / <o:p><\/o:p>/g, '\u00A0<o:p></o:p>' )
+		.replace( /(<span style=['"]mso-spacerun:yes['"]>[^\S\r\n]+)[\r\n]+(\s*<\/span>)/g, '$1$2' )
 		.replace( />(\s*(\r\n?|\n)\s*)+</g, '><' );
 }
 

+ 7 - 0
packages/ckeditor5-paste-from-office/tests/filters/space.js

@@ -24,6 +24,13 @@ describe( 'Filters', () => {
 				expect( normalizeSpacing( input ) ).to.equal( expected );
 			} );
 
+			it( 'should remove newlines from spacerun spans', () => {
+				const input = '<span style=\'mso-spacerun:yes\'>  \r\n</span>';
+				const expected = '<span style=\'mso-spacerun:yes\'>  </span>';
+
+				expect( normalizeSpacing( input ) ).to.equal( expected );
+			} );
+
 			it( 'should remove multiline sequences of whitespaces', () => {
 				const input = '<p>Foo</p> \n\n   \n<p>Bar</p>   \r\n\r\n  <p>Baz</p>';
 				const expected = '<p>Foo</p><p>Bar</p><p>Baz</p>';