From 5e4ce2cf9e06ca65c4639dddf266ce34ddd171da Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Mon, 7 Jan 2019 11:43:34 +0100 Subject: [PATCH 01/10] Tests: added test case. --- tests/plugins/list/list.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/plugins/list/list.js b/tests/plugins/list/list.js index c3839840f81..bc0e54b7d97 100644 --- a/tests/plugins/list/list.js +++ b/tests/plugins/list/list.js @@ -212,5 +212,18 @@ bender.test( { bot.setHtmlWithSelection( '' ); var bList = ed.getCommand( 'bulletedlist' ); assert.areSame( CKEDITOR.TRISTATE_OFF, bList.state, 'check numbered list inactive' ); + }, + + // #2721 + 'test sublist order after removing higher order sublist': function() { + var bot = this.editorBots.editor1, + editor = bot.editor; + + bot.setHtmlWithSelection( '
  1. test
    1. ^
      1. a
      2. b
      3. c
' ); + editor.fire( 'key', { + domEvent: new CKEDITOR.dom.event( { keyCode: 8 } ) + } ); + + assert.areSame( '
  1. test
    1. a
    2. b
    3. c
', bender.tools.compatHtml( editor.getData() ) ); } } ); From aa3cac1e3d7479c2d4a86b634ad8cad4c1f44dc4 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Mon, 7 Jan 2019 11:43:41 +0100 Subject: [PATCH 02/10] Tests: added manual test. --- tests/plugins/list/manual/sublistreverse.html | 19 ++++++++++++++ tests/plugins/list/manual/sublistreverse.md | 26 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/plugins/list/manual/sublistreverse.html create mode 100644 tests/plugins/list/manual/sublistreverse.md diff --git a/tests/plugins/list/manual/sublistreverse.html b/tests/plugins/list/manual/sublistreverse.html new file mode 100644 index 00000000000..04ddd95c037 --- /dev/null +++ b/tests/plugins/list/manual/sublistreverse.html @@ -0,0 +1,19 @@ + + + diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md new file mode 100644 index 00000000000..21979e21e27 --- /dev/null +++ b/tests/plugins/list/manual/sublistreverse.md @@ -0,0 +1,26 @@ +@bender-tags: bug, 2721 +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, list,sourcearea, undo, elementspath + +1. Place caret in list after dollar symbol (`$`). +1. Press backspace two times. + +## Expected + +Sublist is ordered alphabetically: +``` +1. Test + 1. a + 2. b + 3. c +``` + +## Unexpected + +Sublist order is reversed: +``` +1. Test + 1. c + 2. b + 3. a +``` From 3343223ab5d718aeeeb06933e042eccaeb8ee661 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Mon, 7 Jan 2019 11:44:55 +0100 Subject: [PATCH 03/10] Fixed: Sublist items are reversed when using backspace. --- plugins/list/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/list/plugin.js b/plugins/list/plugin.js index f31c633b61d..3ab817f5c88 100755 --- a/plugins/list/plugin.js +++ b/plugins/list/plugin.js @@ -533,6 +533,7 @@ child.remove(); refNode ? child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) : into.append( child, forward ); + refNode = child; } } From 4663844a34f0426a5f3b22676cde44e9ca743eb0 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 11:32:46 +0100 Subject: [PATCH 04/10] Changelog: added entry. --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 18227415a84..814bc2aef4b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,10 @@ ## CKEditor 4.11.3 +Fixed Issues: + +* [#2721](https://github.com/ckeditor/ckeditor-dev/issues/2721): Fixed: Sublist items are reversed when higher order list is removed. + ## CKEditor 4.11.2 Fixed Issues: From 3deb493a623a50d4031186abac11bd55d5b6ab9f Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 12:46:26 +0100 Subject: [PATCH 05/10] Tests: ignored on Edge. --- plugins/list/plugin.js | 1 - tests/plugins/list/manual/sublistreverse.html | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/list/plugin.js b/plugins/list/plugin.js index 3ab817f5c88..f31c633b61d 100755 --- a/plugins/list/plugin.js +++ b/plugins/list/plugin.js @@ -533,7 +533,6 @@ child.remove(); refNode ? child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) : into.append( child, forward ); - refNode = child; } } diff --git a/tests/plugins/list/manual/sublistreverse.html b/tests/plugins/list/manual/sublistreverse.html index 04ddd95c037..e6be6a9dc73 100644 --- a/tests/plugins/list/manual/sublistreverse.html +++ b/tests/plugins/list/manual/sublistreverse.html @@ -15,5 +15,9 @@ From a7f5dc2fc81b04c660f12da0e2559280913e4422 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 12:49:38 +0100 Subject: [PATCH 06/10] Changelog: rephrased entry. --- CHANGES.md | 2 +- plugins/list/plugin.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 814bc2aef4b..f832982b514 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,7 @@ Fixed Issues: -* [#2721](https://github.com/ckeditor/ckeditor-dev/issues/2721): Fixed: Sublist items are reversed when higher order list is removed. +* [#2721](https://github.com/ckeditor/ckeditor-dev/issues/2721): Fixed: Sublist items are reversed when higher level list item is removed. ## CKEditor 4.11.2 diff --git a/plugins/list/plugin.js b/plugins/list/plugin.js index f31c633b61d..3ab817f5c88 100755 --- a/plugins/list/plugin.js +++ b/plugins/list/plugin.js @@ -533,6 +533,7 @@ child.remove(); refNode ? child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) : into.append( child, forward ); + refNode = child; } } From 3b1246da0ce4c9e303ed408c5f397bf4be6bd9dd Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 12:53:09 +0100 Subject: [PATCH 07/10] Tests: added version tag. --- tests/plugins/list/manual/sublistreverse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md index 21979e21e27..6d7ddbc418d 100644 --- a/tests/plugins/list/manual/sublistreverse.md +++ b/tests/plugins/list/manual/sublistreverse.md @@ -1,4 +1,4 @@ -@bender-tags: bug, 2721 +@bender-tags: bug, 2721, 4.11.3 @bender-ui: collapsed @bender-ckeditor-plugins: wysiwygarea, toolbar, list,sourcearea, undo, elementspath From 309be33abf32545d681fa8f0c59aceebf43a99ee Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 12:54:31 +0100 Subject: [PATCH 08/10] Tests: added note for IE. --- tests/plugins/list/manual/sublistreverse.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md index 6d7ddbc418d..e78fb6e261c 100644 --- a/tests/plugins/list/manual/sublistreverse.md +++ b/tests/plugins/list/manual/sublistreverse.md @@ -3,8 +3,7 @@ @bender-ckeditor-plugins: wysiwygarea, toolbar, list,sourcearea, undo, elementspath 1. Place caret in list after dollar symbol (`$`). -1. Press backspace two times. - +1. Press backspace two times (once in IE). ## Expected Sublist is ordered alphabetically: From fce53c39a9ab24024c05ef01ce13161aaf861a7a Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Wed, 9 Jan 2019 12:56:26 +0100 Subject: [PATCH 09/10] Tests: added some empty lines in test descriptions. --- tests/plugins/list/manual/sublistreverse.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md index e78fb6e261c..0e5c30a9e0d 100644 --- a/tests/plugins/list/manual/sublistreverse.md +++ b/tests/plugins/list/manual/sublistreverse.md @@ -4,9 +4,11 @@ 1. Place caret in list after dollar symbol (`$`). 1. Press backspace two times (once in IE). + ## Expected Sublist is ordered alphabetically: + ``` 1. Test 1. a @@ -17,6 +19,7 @@ Sublist is ordered alphabetically: ## Unexpected Sublist order is reversed: + ``` 1. Test 1. c From a9f4a5f11fe69a4456c4863ace867f5f36dd371a Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Tue, 22 Jan 2019 10:23:19 +0100 Subject: [PATCH 10/10] Tests: Added note about IE upstream issue. --- tests/plugins/list/manual/sublistreverse.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/plugins/list/manual/sublistreverse.md b/tests/plugins/list/manual/sublistreverse.md index 0e5c30a9e0d..850f97f83ae 100644 --- a/tests/plugins/list/manual/sublistreverse.md +++ b/tests/plugins/list/manual/sublistreverse.md @@ -1,9 +1,9 @@ @bender-tags: bug, 2721, 4.11.3 @bender-ui: collapsed -@bender-ckeditor-plugins: wysiwygarea, toolbar, list,sourcearea, undo, elementspath +@bender-ckeditor-plugins: wysiwygarea, toolbar, list, sourcearea, undo, elementspath 1. Place caret in list after dollar symbol (`$`). -1. Press backspace two times (once in IE). +1. Press Backspace two times (once in IE). ## Expected @@ -26,3 +26,7 @@ Sublist order is reversed: 2. b 3. a ``` + +## Note + +There is known upstream issue on IE [#2774](https://github.com/ckeditor/ckeditor-dev/issues/2774) when after pressing Backspace only `li` element is removed and `ol` is preserved. This results in incorrect markup `ol > li > ol > ol > li`.