diff --git a/CHANGES.md b/CHANGES.md index 79066354545..81062ab4d7e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ New Features: Fixed Issues: +* [#579](https://github.com/ckeditor/ckeditor-dev/issues/579): Fixed: Internal `cke_table-faked-selection-table` class visible in Stylesheet Classes field in [Table Properties](http://ckeditor.com/addon/table) dialog. * [#545](https://github.com/ckeditor/ckeditor-dev/issues/545): [Edge] Fixed: Error thrown when pressing the Select All button in a [Source Mode](http://ckeditor.com/addon/sourcearea). * [#582](https://github.com/ckeditor/ckeditor-dev/issues/582): Fixed: Double slash in path to stylesheet needed by [Table Selection](http://ckeditor.com/addon/tableselection) plugin. Thanks to [Marius Dumitru Florea](https://github.com/mflorea)! * [#491](https://github.com/ckeditor/ckeditor-dev/issues/491): Fixed: Unnecessary dependency on [Editor Toolbar](http://ckeditor.com/addon/toolbar) plugin inside [Notification](http://ckeditor.com/addon/notification) plugin. diff --git a/plugins/tableselection/plugin.js b/plugins/tableselection/plugin.js index b55ef30c617..20738fc3876 100644 --- a/plugins/tableselection/plugin.js +++ b/plugins/tableselection/plugin.js @@ -7,8 +7,8 @@ 'use strict'; var fakeSelectedClass = 'cke_table-faked-selection', - fakeSelectedTableClass = fakeSelectedClass + '-table', fakeSelectedEditorClass = fakeSelectedClass + '-editor', + fakeSelectedTableDataAttribute = 'cke-table-faked-selection-table', fakeSelection = { active: false }, tabletools, getSelectedCells, @@ -122,7 +122,7 @@ } if ( selectedCells.count() > 0 ) { - selectedCells.getItem( 0 ).getAscendant( 'table' ).removeClass( fakeSelectedTableClass ); + selectedCells.getItem( 0 ).getAscendant( 'table' ).data( fakeSelectedTableDataAttribute, false ); } editor.fire( 'unlockSnapshot' ); @@ -251,7 +251,7 @@ if ( cells.length > 0 ) { editor.editable().addClass( fakeSelectedEditorClass ); - cells[ 0 ].getAscendant( 'table' ).addClass( fakeSelectedTableClass ); + cells[ 0 ].getAscendant( 'table' ).data( fakeSelectedTableDataAttribute, '' ); } editor.fire( 'unlockSnapshot' ); diff --git a/plugins/tableselection/styles/tableselection.css b/plugins/tableselection/styles/tableselection.css index 155bfc20cec..3ad2ab1a879 100644 --- a/plugins/tableselection/styles/tableselection.css +++ b/plugins/tableselection/styles/tableselection.css @@ -1,4 +1,4 @@ -.cke_table-faked-selection-editor *::selection, table.cke_table-faked-selection-table *::selection { +.cke_table-faked-selection-editor *::selection, table[data-cke-table-faked-selection-table] *::selection { background: transparent; } diff --git a/tests/plugins/table/fakeselectionadvancetab.js b/tests/plugins/table/fakeselectionadvancetab.js new file mode 100644 index 00000000000..67be0f53bca --- /dev/null +++ b/tests/plugins/table/fakeselectionadvancetab.js @@ -0,0 +1,27 @@ +/* bender-tags: editor,unit */ +/* bender-ckeditor-plugins: dialogadvtab,table,tableselection */ + +( function() { + 'use strict'; + + bender.editor = true; + + bender.test( { + + // #579 + 'test advance table dialog for ignorig selection class': function() { + if ( !CKEDITOR.plugins.tableselection.isSupportedEnvironment ) { + assert.ignore(); + } + + var bot = this.editorBot; + + // Add table with fake selection. + bot.setHtmlWithSelection( '[]
Cell1Cell2
' ); + + bot.dialog( 'tableProperties', function( dialog ) { + assert.areSame( '', dialog.getValueOf( 'advanced', 'advCSSClasses' ) ); + } ); + } + } ); +} )(); diff --git a/tests/plugins/table/manual/fakeselectionadvancetab.html b/tests/plugins/table/manual/fakeselectionadvancetab.html new file mode 100644 index 00000000000..99f166f9d8f --- /dev/null +++ b/tests/plugins/table/manual/fakeselectionadvancetab.html @@ -0,0 +1,34 @@ + + + diff --git a/tests/plugins/table/manual/fakeselectionadvancetab.md b/tests/plugins/table/manual/fakeselectionadvancetab.md new file mode 100644 index 00000000000..9b264ecff3a --- /dev/null +++ b/tests/plugins/table/manual/fakeselectionadvancetab.md @@ -0,0 +1,13 @@ +@bender-tags: 4.7.2, bug, 579 +@bender-ui: collapsed +@bender-ckeditor-plugins: dialogadvtab,table,tableselection,wysiwygarea + +1. Select at least 2 cells in table. +1. Right click and select `Table Properties`. +1. Make sure that selection is now fake (selection colour changed to grey). +1. Go to `Avanced` tab. +1. Check `Stylesheet Classes`. + +**Expected:** `Stylesheet Classes` field is empty. + +**Unexpected:** `Stylesheet Classes` contains internal cke class with fakeselection. diff --git a/tests/plugins/tableselection/integrations/core/getextractselectedhtml.html b/tests/plugins/tableselection/integrations/core/getextractselectedhtml.html index 4022a64af6d..6166b35fb5c 100644 --- a/tests/plugins/tableselection/integrations/core/getextractselectedhtml.html +++ b/tests/plugins/tableselection/integrations/core/getextractselectedhtml.html @@ -12,7 +12,7 @@

=> - +
@@ -36,7 +36,7 @@
11@

=> - +
@@ -62,7 +62,7 @@
11@
=> - +
@@ -76,4 +76,4 @@
11@
- \ No newline at end of file +