From 55a4b89ab1b80dd2ad5cb559da9f3e9721378c6a Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Wed, 23 Aug 2017 12:12:49 +0200 Subject: [PATCH 01/10] Draft of unit tests --- .../_fixtures/Tickets/423/expected.html | 2 + .../Tickets/423/word2016/chrome.html | 736 ++++++++++++++++++ .../pastefromword/generated/tickets8.js | 39 + 3 files changed, 777 insertions(+) create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Tickets/423/expected.html create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/chrome.html create mode 100644 tests/plugins/pastefromword/generated/tickets8.js diff --git a/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/expected.html b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/expected.html new file mode 100644 index 00000000000..2fd0942ff40 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/expected.html @@ -0,0 +1,2 @@ +Paste from Word
Next

+Totally new diff --git a/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/chrome.html b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/chrome.html new file mode 100644 index 00000000000..079325bc85c --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/chrome.html @@ -0,0 +1,736 @@ + + + + + + + + + + + + + + + + + + + +

Paste from word
+Next

+ +

Totally new

+ + + + + diff --git a/tests/plugins/pastefromword/generated/tickets8.js b/tests/plugins/pastefromword/generated/tickets8.js new file mode 100644 index 00000000000..7c8076af841 --- /dev/null +++ b/tests/plugins/pastefromword/generated/tickets8.js @@ -0,0 +1,39 @@ +/* bender-tags: clipboard,pastefromword */ +/* jshint ignore:start */ +/* bender-ckeditor-plugins: pastefromword,ajax,basicstyles,bidi,font,link,toolbar,colorbutton,image */ +/* bender-ckeditor-plugins: list,liststyle,sourcearea,format,justify,table,tableresize,tabletools,indent,indentblock,div,dialog */ +/* jshint ignore:end */ +/* bender-include: _lib/q.js,_helpers/promisePasteEvent.js,_helpers/assertWordFilter.js,_helpers/createTestCase.js */ +/* bender-include: _helpers/createTestSuite.js,_helpers/pfwTools.js */ +/* global createTestSuite */ + +( function() { + 'use strict'; + + var config = { + language: 'en', + removePlugins: 'dialogadvtab,flash,showborders,horizontalrule', + colorButton_normalizeBackground: false, + disallowedContent: 'td{vertical-align}; span; p{margin-*}', + enterMode: CKEDITOR.ENTER_BR + }; + + bender.editor = { + config: config + }; + + bender.test( createTestSuite( { + browsers: [ + 'chrome' + ], + wordVersions: [ + 'word2016' + ], + tests: { + 'Tickets/423': true + }, + + compareRawData: false, + ignoreAll: CKEDITOR.env.ie && CKEDITOR.env.version <= 11 + } ) ); +} )(); From 585c128108a556dbc7e9dfbb1b3505d2bb4adc15 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Wed, 23 Aug 2017 16:55:28 +0200 Subject: [PATCH 02/10] Update for Unit test. BR mode check. --- .../generated/_fixtures/Tickets/423/word2016/firefox.html | 6 ++++++ .../generated/_fixtures/Tickets/423/word2016/ie11.html | 8 ++++++++ tests/plugins/pastefromword/generated/tickets8.js | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/firefox.html create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html diff --git a/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/firefox.html b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/firefox.html new file mode 100644 index 00000000000..60f48b67ea5 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/firefox.html @@ -0,0 +1,6 @@ +

Paste from word
+ Next

+ +

Totally new

diff --git a/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html new file mode 100644 index 00000000000..934b878b51d --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html @@ -0,0 +1,8 @@ + + +

Paste from word
+ Next

+ +

Totally new

+ + diff --git a/tests/plugins/pastefromword/generated/tickets8.js b/tests/plugins/pastefromword/generated/tickets8.js index 7c8076af841..e5c1f33c27b 100644 --- a/tests/plugins/pastefromword/generated/tickets8.js +++ b/tests/plugins/pastefromword/generated/tickets8.js @@ -24,7 +24,9 @@ bender.test( createTestSuite( { browsers: [ - 'chrome' + 'chrome', + 'firefox', + 'ie11' ], wordVersions: [ 'word2016' From e3f604cf4f27592c374fc3438ed87daf8bfd1d34 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Wed, 23 Aug 2017 16:56:19 +0200 Subject: [PATCH 03/10] Fix for pasting in BR mode. --- plugins/pastefromword/filter/default.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index fdb40e73106..960d51a160a 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -155,6 +155,14 @@ style[ 'mso-list' ].match( /level/ ) ) { container.attributes[ 'cke-list-level' ] = style[ 'mso-list' ].match( /level(\d+)/ )[1]; } + + if ( editor.config.enterMode == CKEDITOR.ENTER_BR ) { + // We suffer from attribute/style lost in this situation. + delete element.name; + element.add( new CKEDITOR.htmlParser.element( 'br' ) ); + } else { + // elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element ); + } } Style.createStyleStack( element, filter, editor ); From 30720e897911ed7bed2e87a37d26f984c294fb7e Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 24 Aug 2017 12:10:46 +0200 Subject: [PATCH 04/10] Rework unit tests --- .../generated/_fixtures/Enter_BR/Enter_BR.docx | Bin 0 -> 11502 bytes .../{Tickets/423 => Enter_BR}/expected.html | 0 .../423 => Enter_BR}/word2016/chrome.html | 0 .../423 => Enter_BR}/word2016/firefox.html | 6 ++---- .../423 => Enter_BR}/word2016/ie11.html | 0 .../_fixtures/Enter_BR/word2016/ie8.html | 2 ++ .../generated/{tickets8.js => enter_br.js} | 16 +++++++--------- 7 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Enter_BR/Enter_BR.docx rename tests/plugins/pastefromword/generated/_fixtures/{Tickets/423 => Enter_BR}/expected.html (100%) rename tests/plugins/pastefromword/generated/_fixtures/{Tickets/423 => Enter_BR}/word2016/chrome.html (100%) rename tests/plugins/pastefromword/generated/_fixtures/{Tickets/423 => Enter_BR}/word2016/firefox.html (56%) rename tests/plugins/pastefromword/generated/_fixtures/{Tickets/423 => Enter_BR}/word2016/ie11.html (100%) create mode 100644 tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie8.html rename tests/plugins/pastefromword/generated/{tickets8.js => enter_br.js} (51%) diff --git a/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/Enter_BR.docx b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/Enter_BR.docx new file mode 100644 index 0000000000000000000000000000000000000000..f92c307e167417b0bfd38bfe1abb48115299bd3b GIT binary patch literal 11502 zcmeHt1y@{2w{`a`8CCY+@m@n~JjC`je{aQtR#u0KL9!*IWWQQr*XZ@1SWLA=#He$p{Q68V@ok)e z6*v9D+$N*189vo|Jj;sc0GFRFM{^6lJQoxTd0kiRh$_;{^t^O`9Ib0WBwa$328CAy zJJI`lT=uoAmKB(!6-r0imv!(2s0P`XPvffRIDPD;$?(h;T&A>MCCI-ws>Kf3_uiY% ziuX=ZigsS|cOg891mX!ND``f;AApEK9Ln_ly<`RM#>HV3-fDWDpDXhj6qlZ_ovVMK zti4@i6laEt83m{2mTBcIXFk%v7eqic3rK7%5u(w?tN{W1JBsgdJMYXH{0DPR3G>DgCf@E3O3 zB82_hOLunHFaW^gBMd<4Zb4)|A+ba%TF(j z?Xd1*K^8gofAF7ZQC{r8%Tr`F9bdv*fJe}kk;ht^x1Rg{ATU15#lb7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!)%Lf)aq3|7ksm1sdId2&8d<0AE@wQRaOJeDc#I5c3y%`>~6e z5(}}w502!|8xU-sd_nDx5CLz35zdPeffJcCD*kKQjG|@MBTh3asvO)o6<+pYhWN`* z;xiSI4YatC$|?!As5#4Ztm76}i|ir2(yQBy2Wm39%0_%lD=vMyGz zejHd(fb{GC)vQ-HO?A-@Q;oI33^BR?!_Ma)ChSx;N8a# zY_ldkeKv-r+MLQNM`N9*ACF%;bGUujNKj+A$4T|^H8}`jlt}b1AT&&}ZmPx)yq%h< zv}X!R%vx$ZUs(87igy`l@bWOKjWXtqTZBq+`bU4_k80qV7gJd&48EU+?p;2T!FZIv zsVzCMI`5Q?UwAX{q1kk+@M7{od0Fh#PaRFE?D@XD-)wicC zeI7}xNQU}7Zs9kukCYLVi*Vo-HC9k5cgx2|IpGJ$()o|IH54=>L`M4e#Lyqxo?owj zNfT9)`@4a^r?LGCj)RCUza+K&4*Yw5&#%B5$np69FWcvLOTXuQ{AFtolKuLR43OX9 zzn{qe1rLR6JAT4{KcD~I#P7#1f0Paste from word
+

Paste from word
Next

-

Totally new

+

Totally new

diff --git a/tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie11.html similarity index 100% rename from tests/plugins/pastefromword/generated/_fixtures/Tickets/423/word2016/ie11.html rename to tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie11.html diff --git a/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie8.html b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie8.html new file mode 100644 index 00000000000..2f30e500c45 --- /dev/null +++ b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/ie8.html @@ -0,0 +1,2 @@ +

Paste from word
Next

+

Totally new

diff --git a/tests/plugins/pastefromword/generated/tickets8.js b/tests/plugins/pastefromword/generated/enter_br.js similarity index 51% rename from tests/plugins/pastefromword/generated/tickets8.js rename to tests/plugins/pastefromword/generated/enter_br.js index e5c1f33c27b..6d77e84bb68 100644 --- a/tests/plugins/pastefromword/generated/tickets8.js +++ b/tests/plugins/pastefromword/generated/enter_br.js @@ -1,10 +1,9 @@ /* bender-tags: clipboard,pastefromword */ /* jshint ignore:start */ -/* bender-ckeditor-plugins: pastefromword,ajax,basicstyles,bidi,font,link,toolbar,colorbutton,image */ -/* bender-ckeditor-plugins: list,liststyle,sourcearea,format,justify,table,tableresize,tabletools,indent,indentblock,div,dialog */ +/* bender-ckeditor-plugins: pastefromword,ajax,basicstyles,toolbar */ /* jshint ignore:end */ /* bender-include: _lib/q.js,_helpers/promisePasteEvent.js,_helpers/assertWordFilter.js,_helpers/createTestCase.js */ -/* bender-include: _helpers/createTestSuite.js,_helpers/pfwTools.js */ +/* bender-include: _helpers/createTestSuite.js */ /* global createTestSuite */ ( function() { @@ -12,9 +11,8 @@ var config = { language: 'en', - removePlugins: 'dialogadvtab,flash,showborders,horizontalrule', colorButton_normalizeBackground: false, - disallowedContent: 'td{vertical-align}; span; p{margin-*}', + allowedContent: 'p strong em', enterMode: CKEDITOR.ENTER_BR }; @@ -26,16 +24,16 @@ browsers: [ 'chrome', 'firefox', - 'ie11' + 'ie11', + 'ie8' ], wordVersions: [ 'word2016' ], tests: { - 'Tickets/423': true + 'Enter_BR': true }, - compareRawData: false, - ignoreAll: CKEDITOR.env.ie && CKEDITOR.env.version <= 11 + compareRawData: false } ) ); } )(); From 53312b8779ded62e674710db7fa379337b2ffdb5 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 24 Aug 2017 12:12:11 +0200 Subject: [PATCH 05/10] Fix improvement --- plugins/pastefromword/filter/default.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js index 960d51a160a..ae326b8c36f 100644 --- a/plugins/pastefromword/filter/default.js +++ b/plugins/pastefromword/filter/default.js @@ -156,13 +156,13 @@ container.attributes[ 'cke-list-level' ] = style[ 'mso-list' ].match( /level(\d+)/ )[1]; } + // Adapt paragraph formatting to editor's convention according to enter-mode (#423). if ( editor.config.enterMode == CKEDITOR.ENTER_BR ) { // We suffer from attribute/style lost in this situation. delete element.name; element.add( new CKEDITOR.htmlParser.element( 'br' ) ); - } else { - // elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element ); } + } Style.createStyleStack( element, filter, editor ); From 019a993e1e00396d13276c4f38f8ad55672cb2b7 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 24 Aug 2017 12:48:17 +0200 Subject: [PATCH 06/10] Manual tests --- tests/plugins/pastefromword/manual/enterbr.html | 8 ++++++++ tests/plugins/pastefromword/manual/enterbr.md | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/plugins/pastefromword/manual/enterbr.html create mode 100644 tests/plugins/pastefromword/manual/enterbr.md diff --git a/tests/plugins/pastefromword/manual/enterbr.html b/tests/plugins/pastefromword/manual/enterbr.html new file mode 100644 index 00000000000..a3e1790c506 --- /dev/null +++ b/tests/plugins/pastefromword/manual/enterbr.html @@ -0,0 +1,8 @@ + + diff --git a/tests/plugins/pastefromword/manual/enterbr.md b/tests/plugins/pastefromword/manual/enterbr.md new file mode 100644 index 00000000000..3628b045ab7 --- /dev/null +++ b/tests/plugins/pastefromword/manual/enterbr.md @@ -0,0 +1,14 @@ +@bender-tags: bug, 4.7.3, word +@bender-ui: collapsed +@bender-ckeditor-plugins: pastefromword,toolbar,basicstyles,wysiwygarea,sourcearea + +---- +1. Open [docx file](https://github.com/ckeditor/ckeditor-dev/blob/master/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/Enter_BR.docx) in Microsft Word. +1. Copy text from file and paste it to editor. +1. Check Source in editor. + +**Expected:** There is no `

` tags in source. Every pparagraph is replaced wit `
`. + +**Unexpected:** There are `

` tag after paste. + + From 822b2468074d9011690bbfc50262886bc0357681 Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 24 Aug 2017 15:34:08 +0200 Subject: [PATCH 07/10] Fixes after review. --- .../_fixtures/Enter_BR/word2016/firefox.html | 739 +++++++++++++++++- tests/plugins/pastefromword/manual/enterbr.md | 4 +- 2 files changed, 738 insertions(+), 5 deletions(-) diff --git a/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/firefox.html b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/firefox.html index b027f982d53..c95c785e76b 100644 --- a/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/firefox.html +++ b/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/word2016/firefox.html @@ -1,4 +1,737 @@ -

Paste from word
- Next

-

Totally new

+ + + + + + + + + + + + + + + + + + + +

Paste from word
+Next

+ +

Totally new

+ + + + + diff --git a/tests/plugins/pastefromword/manual/enterbr.md b/tests/plugins/pastefromword/manual/enterbr.md index 3628b045ab7..a57fe07ff97 100644 --- a/tests/plugins/pastefromword/manual/enterbr.md +++ b/tests/plugins/pastefromword/manual/enterbr.md @@ -3,11 +3,11 @@ @bender-ckeditor-plugins: pastefromword,toolbar,basicstyles,wysiwygarea,sourcearea ---- -1. Open [docx file](https://github.com/ckeditor/ckeditor-dev/blob/master/tests/plugins/pastefromword/generated/_fixtures/Enter_BR/Enter_BR.docx) in Microsft Word. +1. Open [docx file](../generated/_fixtures/Enter_BR/Enter_BR.docx) in Microsft Word. 1. Copy text from file and paste it to editor. 1. Check Source in editor. -**Expected:** There is no `

` tags in source. Every pparagraph is replaced wit `
`. +**Expected:** There is no `

` tags in source. Every paragraph is replaced with `
`. **Unexpected:** There are `

` tag after paste. From cdd82c698c04a95ba10372241f552152dace49df Mon Sep 17 00:00:00 2001 From: Mateusz Samsel Date: Thu, 24 Aug 2017 16:32:40 +0200 Subject: [PATCH 08/10] Fix for manual test --- tests/plugins/pastefromword/manual/enterbr.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/plugins/pastefromword/manual/enterbr.html b/tests/plugins/pastefromword/manual/enterbr.html index a3e1790c506..ce93b01db6e 100644 --- a/tests/plugins/pastefromword/manual/enterbr.html +++ b/tests/plugins/pastefromword/manual/enterbr.html @@ -3,6 +3,7 @@ From 71fd4c28dc6b8c557ddf194ea18a713bad521f86 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Thu, 24 Aug 2017 17:17:49 +0200 Subject: [PATCH 09/10] Add enterkey plugin to manual test. --- tests/plugins/pastefromword/manual/enterbr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/pastefromword/manual/enterbr.md b/tests/plugins/pastefromword/manual/enterbr.md index a57fe07ff97..26f267e0efc 100644 --- a/tests/plugins/pastefromword/manual/enterbr.md +++ b/tests/plugins/pastefromword/manual/enterbr.md @@ -1,6 +1,6 @@ @bender-tags: bug, 4.7.3, word @bender-ui: collapsed -@bender-ckeditor-plugins: pastefromword,toolbar,basicstyles,wysiwygarea,sourcearea +@bender-ckeditor-plugins: pastefromword,toolbar,basicstyles,enterkey,wysiwygarea,sourcearea ---- 1. Open [docx file](../generated/_fixtures/Enter_BR/Enter_BR.docx) in Microsft Word. From ce334259118a41479aab55a3c033607d129c558b Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Thu, 24 Aug 2017 17:25:42 +0200 Subject: [PATCH 10/10] Update changelog [ci skip]. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 1b352986abb..c98b0ad2198 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Fixed Issues: * [#554](https://github.com/ckeditor/ckeditor-dev/issues/554): Fixed: [`change`](https://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change) event not fired when typing the first character after pasting into the editor. Thanks to [Daniel Miller](https://github.com/millerdev)! * [#566](https://github.com/ckeditor/ckeditor-dev/issues/566): Fixed: The CSS border shorthand property with zero width (`border: 0px solid #000;`) no longer causes table to have border attribute set to 1. * [#779](https://github.com/ckeditor/ckeditor-dev/issues/779): Fixed: [Remove Format](https://ckeditor.com/addon/removeformat) plugin removes elements with language definition inserted by [Language](https://ckeditor.com/addon/language) plugin. +* [#423](https://github.com/ckeditor/ckeditor-dev/issues/423): Fixed: [Paste from Word](https://ckeditor.com/addon/pastefromword) plugin pastes paragraphs into the editor even if [`CKEDITOR.config.enterMode`](https://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode) is set to `CKEDITOR.ENTER_BR`. ## CKEditor 4.7.2