From 7ab7c83a01efd081cf39950636f47503b03732d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Tue, 13 Aug 2019 14:47:06 +0200 Subject: [PATCH 1/8] Fix image/adjacent groups normalized fixture for word 2016 in Safari. --- .../normalized.safari.word2016.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/_data/image/adjacent-groups/normalized.safari.word2016.html b/tests/_data/image/adjacent-groups/normalized.safari.word2016.html index 6af0dc9..ac32e4c 100644 --- a/tests/_data/image/adjacent-groups/normalized.safari.word2016.html +++ b/tests/_data/image/adjacent-groups/normalized.safari.word2016.html @@ -23,15 +23,15 @@ - + 

-

-

-

-

-

-

+

 

+

 

+

 

+

 

+

 

+

 


From 78ca2cfa8255e67e464dd9c5894d10397d111e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Wed, 14 Aug 2019 14:41:18 +0200 Subject: [PATCH 2/8] Fix safari adjacent groups tests in safari - space is allowed in clipboard holder. --- tests/_data/image/adjacent-groups/model.safari.word2016.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_data/image/adjacent-groups/model.safari.word2016.html b/tests/_data/image/adjacent-groups/model.safari.word2016.html index ee6b7a6..68f211d 100644 --- a/tests/_data/image/adjacent-groups/model.safari.word2016.html +++ b/tests/_data/image/adjacent-groups/model.safari.word2016.html @@ -18,7 +18,7 @@ - + From 46887fa059c070f8bf0a0880d42243aaddbdbf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Tue, 3 Sep 2019 15:59:05 +0200 Subject: [PATCH 3/8] Introduce blockFillerMode in DomConverter. --- src/filters/parse.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/filters/parse.js b/src/filters/parse.js index 174cc5a..58279d3 100644 --- a/src/filters/parse.js +++ b/src/filters/parse.js @@ -10,7 +10,6 @@ /* globals DOMParser */ import DomConverter from '@ckeditor/ckeditor5-engine/src/view/domconverter'; -import { NBSP_FILLER } from '@ckeditor/ckeditor5-engine/src/view/filler'; import { normalizeSpacing, normalizeSpacerunSpans } from './space'; @@ -61,7 +60,7 @@ export function parseHtml( htmlString ) { // @param {Document} htmlDocument Native `Document` object to be transformed. // @returns {module:engine/view/documentfragment~DocumentFragment} function documentToView( htmlDocument ) { - const domConverter = new DomConverter( { blockFiller: NBSP_FILLER } ); + const domConverter = new DomConverter( { blockFillerMode: 'nbsp' } ); const fragment = htmlDocument.createDocumentFragment(); const nodes = htmlDocument.body.childNodes; From 85afff151280ee51defce4dcff0ffa8a84016480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Fri, 6 Sep 2019 14:32:50 +0200 Subject: [PATCH 4/8] Fix editor destroy in integration tests. --- tests/_utils/utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/_utils/utils.js b/tests/_utils/utils.js index 8fad203..8558c4e 100644 --- a/tests/_utils/utils.js +++ b/tests/_utils/utils.js @@ -221,9 +221,10 @@ function generateIntegrationTests( title, fixtures, editorConfig, skip ) { } ); after( () => { - editor.destroy(); - - element.remove(); + return editor.destroy() + .then( () => { + element.remove(); + } ); } ); for ( const name of Object.keys( fixtures.input ) ) { From c5468930c2fabf8a85d15e53972e9f9f43cf22a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Fri, 6 Sep 2019 14:58:25 +0200 Subject: [PATCH 5/8] Minor imporovments to running PFO tests. --- tests/_utils/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/_utils/utils.js b/tests/_utils/utils.js index 8558c4e..bd6e397 100644 --- a/tests/_utils/utils.js +++ b/tests/_utils/utils.js @@ -152,7 +152,9 @@ function generateNormalizationTests( title, fixtures, editorConfig, skip ) { } ); for ( const name of Object.keys( fixtures.input ) ) { - ( skip.indexOf( name ) !== -1 ? it.skip : it )( name, () => { + const testRunner = skip.indexOf( name ) !== -1 ? it.skip : it; + + testRunner( name, () => { // Simulate data from Clipboard event const clipboardPlugin = editor.plugins.get( 'Clipboard' ); const content = htmlDataProcessor.toView( normalizeClipboardData( fixtures.input[ name ] ) ); @@ -228,7 +230,9 @@ function generateIntegrationTests( title, fixtures, editorConfig, skip ) { } ); for ( const name of Object.keys( fixtures.input ) ) { - ( skip.indexOf( name ) !== -1 ? it.skip : it )( name, () => { + const testRunner = skip.indexOf( name ) !== -1 ? it.skip : it; + + testRunner( name, () => { data.input = fixtures.input[ name ]; data.model = fixtures.model[ name ]; expectModel( data, editor, fixtures.inputRtf && fixtures.inputRtf[ name ] ); From 087c495102ded98e327dd91f71d854cc3b8e378b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Fri, 6 Sep 2019 15:25:55 +0200 Subject: [PATCH 6/8] Remove   block filler from pasted data. --- src/filters/space.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/filters/space.js b/src/filters/space.js index 54d83df..f343ac4 100644 --- a/src/filters/space.js +++ b/src/filters/space.js @@ -24,6 +24,8 @@ export function normalizeSpacing( htmlString ) { .replace( /<\/span>/g, '' ) .replace( / <\//g, '\u00A0<\/o:p>/g, '\u00A0' ) + // Remove block filler from empty paragraph. Safari uses \u00A0 instead of  . + .replace( /( |\u00A0)<\/o:p>/g, '' ) // Remove all whitespaces when they contain any \r or \n. .replace( />(\s*[\r\n]\s*)<' ); } @@ -59,4 +61,3 @@ function normalizeSafariSpaceSpans( htmlString ) { return spaces.length === 1 ? ' ' : Array( spaces.length + 1 ).join( '\u00A0 ' ).substr( 0, spaces.length ); } ); } - From 65c0e82f3509db45f4c73b7feda90cda61c99fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Go=C5=82aszewski?= Date: Fri, 6 Sep 2019 15:28:18 +0200 Subject: [PATCH 7/8] Align fixtures to the changes in block filler removal. --- .../adjacent-groups/model.safari.word2016.html | 2 +- .../normalized.safari.word2016.html | 14 +++++++------- .../image/adjacent-groups/normalized.word2016.html | 13 ++++++------- .../image/linked/normalized.safari.word2016.html | 2 +- tests/_data/image/linked/normalized.word2016.html | 2 +- .../_data/image/online-offline/model.word2016.html | 2 +- .../shapes-online-offline/model.word2016.html | 2 +- .../normalized.safari.word2016.html | 2 +- .../shapes-online-offline/normalized.word2016.html | 2 +- .../many-one-item/normalized.safari.word2016.html | 6 +++--- .../list/many-one-item/normalized.word2016.html | 6 +++--- 11 files changed, 26 insertions(+), 27 deletions(-) diff --git a/tests/_data/image/adjacent-groups/model.safari.word2016.html b/tests/_data/image/adjacent-groups/model.safari.word2016.html index 68f211d..ee6b7a6 100644 --- a/tests/_data/image/adjacent-groups/model.safari.word2016.html +++ b/tests/_data/image/adjacent-groups/model.safari.word2016.html @@ -18,7 +18,7 @@ - + diff --git a/tests/_data/image/adjacent-groups/normalized.safari.word2016.html b/tests/_data/image/adjacent-groups/normalized.safari.word2016.html index ac32e4c..76d8e2a 100644 --- a/tests/_data/image/adjacent-groups/normalized.safari.word2016.html +++ b/tests/_data/image/adjacent-groups/normalized.safari.word2016.html @@ -23,15 +23,15 @@ -  +

-

 

-

 

-

 

-

 

-

 

-

 

+

+

+

+

+

+


diff --git a/tests/_data/image/adjacent-groups/normalized.word2016.html b/tests/_data/image/adjacent-groups/normalized.word2016.html index 5ee3801..cd6a437 100644 --- a/tests/_data/image/adjacent-groups/normalized.word2016.html +++ b/tests/_data/image/adjacent-groups/normalized.word2016.html @@ -29,20 +29,19 @@
-  

-

 

+

-

 

+

-

 

+

-

 

+

-

 

+

-

 

+


diff --git a/tests/_data/image/linked/normalized.safari.word2016.html b/tests/_data/image/linked/normalized.safari.word2016.html index bb8ced3..d8843b0 100644 --- a/tests/_data/image/linked/normalized.safari.word2016.html +++ b/tests/_data/image/linked/normalized.safari.word2016.html @@ -12,5 +12,5 @@

- +

diff --git a/tests/_data/image/linked/normalized.word2016.html b/tests/_data/image/linked/normalized.word2016.html index 6fd61d4..aa0ec33 100644 --- a/tests/_data/image/linked/normalized.word2016.html +++ b/tests/_data/image/linked/normalized.word2016.html @@ -9,4 +9,4 @@

-

 

+

 

diff --git a/tests/_data/image/online-offline/model.word2016.html b/tests/_data/image/online-offline/model.word2016.html index af226cf..f013983 100644 --- a/tests/_data/image/online-offline/model.word2016.html +++ b/tests/_data/image/online-offline/model.word2016.html @@ -4,5 +4,5 @@ My drawing: -hehehehe :D + hehehehe :D diff --git a/tests/_data/image/shapes-online-offline/model.word2016.html b/tests/_data/image/shapes-online-offline/model.word2016.html index 2cb1297..a6bb9e7 100644 --- a/tests/_data/image/shapes-online-offline/model.word2016.html +++ b/tests/_data/image/shapes-online-offline/model.word2016.html @@ -4,7 +4,7 @@ My drawing: -hehehehe :D + hehehehe :D Additional shape made within Word is added here: diff --git a/tests/_data/image/shapes-online-offline/normalized.safari.word2016.html b/tests/_data/image/shapes-online-offline/normalized.safari.word2016.html index 3b03f49..fbafcae 100644 --- a/tests/_data/image/shapes-online-offline/normalized.safari.word2016.html +++ b/tests/_data/image/shapes-online-offline/normalized.safari.word2016.html @@ -27,5 +27,5 @@

- +

diff --git a/tests/_data/image/shapes-online-offline/normalized.word2016.html b/tests/_data/image/shapes-online-offline/normalized.word2016.html index 5e71531..d4126a9 100644 --- a/tests/_data/image/shapes-online-offline/normalized.word2016.html +++ b/tests/_data/image/shapes-online-offline/normalized.word2016.html @@ -15,4 +15,4 @@ Additional shape made within Word is added here:

-

 

+

diff --git a/tests/_data/list/many-one-item/normalized.safari.word2016.html b/tests/_data/list/many-one-item/normalized.safari.word2016.html index 334e675..f5313e7 100644 --- a/tests/_data/list/many-one-item/normalized.safari.word2016.html +++ b/tests/_data/list/many-one-item/normalized.safari.word2016.html @@ -64,7 +64,7 @@ -

+

  • @@ -82,7 +82,7 @@
-

+

  • @@ -100,7 +100,7 @@
-

+