diff --git a/packages/ckeditor5-paste-from-office/src/filters/space.js b/packages/ckeditor5-paste-from-office/src/filters/space.js index 87fcb28b074..9a893310167 100644 --- a/packages/ckeditor5-paste-from-office/src/filters/space.js +++ b/packages/ckeditor5-paste-from-office/src/filters/space.js @@ -39,9 +39,12 @@ export function normalizeSpacing( htmlString ) { */ export function normalizeSpacerunSpans( htmlDocument ) { htmlDocument.querySelectorAll( 'span[style*=spacerun]' ).forEach( el => { - const innerTextLength = el.innerText.length || 0; - - el.innerHTML = Array( innerTextLength + 1 ).join( '\u00A0 ' ).substr( 0, innerTextLength ); + // For paste contents from WPS Office, the span's inner text is not all of spaces or blank, + // so we should keep the origin contents, or replace ONLY space characters. + if ( /[^\b]/.test( el.innerText.trim() ) === false ) { + const innerTextLength = el.innerText.length || 0; + el.innerHTML = Array( innerTextLength + 1 ).join( '\u00A0 ' ).substr( 0, innerTextLength ); + } } ); }