From 55f1eb8fc15b922b556278827eea49f32882b94b Mon Sep 17 00:00:00 2001 From: Jonathan Cottrill Date: Wed, 6 May 2015 00:33:47 -0500 Subject: [PATCH 1/4] ticket-13254: Fix block outdent failure when using divarea plugin instead of iframe --- plugins/indentblock/plugin.js | 4 +++- tests/tickets/13254/1.html | 11 +++++++++++ tests/tickets/13254/1.js | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/tickets/13254/1.html create mode 100644 tests/tickets/13254/1.js diff --git a/plugins/indentblock/plugin.js b/plugins/indentblock/plugin.js index 0e4f043bc5c..63bb70bf147 100644 --- a/plugins/indentblock/plugin.js +++ b/plugins/indentblock/plugin.js @@ -53,7 +53,9 @@ // Switch context from somewhere inside list item to list item, // if not found just assign self (doing nothing). if ( !firstBlock.is( $listItem ) ) { - firstBlock = firstBlock.getAscendant( $listItem ) || firstBlock; + var ascendant = firstBlock.getAscendant( $listItem ); + + firstBlock = ( ascendant && path.contains( ascendant ) ) || firstBlock; } // Switch context from list item to list diff --git a/tests/tickets/13254/1.html b/tests/tickets/13254/1.html new file mode 100644 index 00000000000..49d1c8a98fe --- /dev/null +++ b/tests/tickets/13254/1.html @@ -0,0 +1,11 @@ + + + +
+ +
+ diff --git a/tests/tickets/13254/1.js b/tests/tickets/13254/1.js new file mode 100644 index 00000000000..f4285539c1a --- /dev/null +++ b/tests/tickets/13254/1.js @@ -0,0 +1,33 @@ +/* bender-tags: editor,unit */ +/* bender-ckeditor-plugins: button,indent,indentblock,divarea */ + +( function() { + 'use strict'; + + bender.test( { + 'test indenting and outdenting block in divarea plugin container inside li': function() { + bender.editorBot.create( { + creator: 'replace', + name: 'editor' + }, function( bot ) { + var editor = bot.editor; + + editor.focus(); + bender.tools.selection.setWithHtml( editor, '

hello{}

' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'initial indent state' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'initial outdent state' ); + + editor.execCommand( 'indent' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after indenting' ); + assert.areSame( 2, editor.getCommand( 'outdent' ).state, 'outdent state after indenting' ); + + editor.execCommand( 'outdent' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after outdenting' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'outdent state after outdenting' ); + } ); + } + } ); +} )(); From 0c0db1c6d0e5e12e7c3acf1b89df8b9a846e822f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Fri, 8 May 2015 14:47:46 +0200 Subject: [PATCH 2/4] Tests: Simplified tests. --- tests/tickets/13254/1.html | 4 ---- tests/tickets/13254/1.js | 45 ++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/tests/tickets/13254/1.html b/tests/tickets/13254/1.html index 49d1c8a98fe..5f8ca7a845c 100644 --- a/tests/tickets/13254/1.html +++ b/tests/tickets/13254/1.html @@ -1,6 +1,3 @@ - - -
  • @@ -8,4 +5,3 @@
- diff --git a/tests/tickets/13254/1.js b/tests/tickets/13254/1.js index f4285539c1a..bd1b4e28c7b 100644 --- a/tests/tickets/13254/1.js +++ b/tests/tickets/13254/1.js @@ -1,33 +1,30 @@ -/* bender-tags: editor,unit */ +/* bender-tags: indent,indentblock */ /* bender-ckeditor-plugins: button,indent,indentblock,divarea */ -( function() { - 'use strict'; +'use strict'; - bender.test( { - 'test indenting and outdenting block in divarea plugin container inside li': function() { - bender.editorBot.create( { - creator: 'replace', - name: 'editor' - }, function( bot ) { - var editor = bot.editor; +bender.editor = { + creator: 'replace', + name: 'editor' +}; - editor.focus(); - bender.tools.selection.setWithHtml( editor, '

hello{}

' ); +bender.test( { + 'test indenting and outdenting block in divarea plugin container inside li': function() { + var editor = this.editor; + editor.focus(); + bender.tools.selection.setWithHtml( editor, '

hello{}

' ); - assert.areSame( 2, editor.getCommand( 'indent' ).state, 'initial indent state' ); - assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'initial outdent state' ); + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'initial indent state' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'initial outdent state' ); - editor.execCommand( 'indent' ); + editor.execCommand( 'indent' ); - assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after indenting' ); - assert.areSame( 2, editor.getCommand( 'outdent' ).state, 'outdent state after indenting' ); + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after indenting' ); + assert.areSame( 2, editor.getCommand( 'outdent' ).state, 'outdent state after indenting' ); - editor.execCommand( 'outdent' ); + editor.execCommand( 'outdent' ); - assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after outdenting' ); - assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'outdent state after outdenting' ); - } ); - } - } ); -} )(); + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after outdenting' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'outdent state after outdenting' ); + } +} ); From da02cc7bd39af7c3fdc46e87538ff3011100c68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Fri, 8 May 2015 14:59:50 +0200 Subject: [PATCH 3/4] Tests: Added manual test. --- tests/tickets/13254/2.html | 13 +++++++++++++ tests/tickets/13254/2.md | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/tickets/13254/2.html create mode 100644 tests/tickets/13254/2.md diff --git a/tests/tickets/13254/2.html b/tests/tickets/13254/2.html new file mode 100644 index 00000000000..b9a34a53f29 --- /dev/null +++ b/tests/tickets/13254/2.html @@ -0,0 +1,13 @@ +
+
    +
  • + +
  • +
+
+ + \ No newline at end of file diff --git a/tests/tickets/13254/2.md b/tests/tickets/13254/2.md new file mode 100644 index 00000000000..fabe5edc755 --- /dev/null +++ b/tests/tickets/13254/2.md @@ -0,0 +1,8 @@ +@bender-tags: 4.4.8, tc +@bender-ui: collapsed +@bender-tags: indent,indentblock + +1. Indent block. + * Expected: Outdent button is not disabled. +2. Outent block. + * Expected: It worked. \ No newline at end of file From 9e5432af4a586df746010018b551503b780ba5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Koszuli=C5=84ski?= Date: Fri, 8 May 2015 15:18:57 +0200 Subject: [PATCH 4/4] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index be78c80dc70..6177427fc16 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ CKEditor 4 Changelog Fixed Issues: * [#12899](http://dev.ckeditor.com/ticket/12899): Fixed: Corrected wrong tag ending for horizontal box definition in the [Dialog User Interface](http://ckeditor.com/addon/dialogui) plugin. Thanks to [mizafish](https://github.com/mizafish)! +* [#13254](http://dev.ckeditor.com/ticket/13254): Fixed: Cannot outdent block after indent when using [Divarea](http://ckeditor.com/addon/divarea) plugin. Thanks to [Jonathan Cottrill](https://github.com/jcttrll)! * [#12796](http://dev.ckeditor.com/ticket/12796): Fixed: The [Indent List](http://ckeditor.com/addon/indentlist) plugin unwraps parent `
  • ` elements. * [#12885](http://dev.ckeditor.com/ticket/12885): Added missing [`editor.getData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData) parameter documentation. * [#11982](http://dev.ckeditor.com/ticket/11982): Bullet added in wrong position after the *Enter* key is pressed in a nested list.