8
0
Просмотр исходного кода

Merge branch 'master' into t/ckeditor5-engine/1336

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
58a30d0af0
25 измененных файлов с 311 добавлено и 92 удалено
  1. 13 0
      packages/ckeditor5-table/CHANGELOG.md
  2. 8 8
      packages/ckeditor5-table/lang/translations/fr.po
  3. 2 2
      packages/ckeditor5-table/lang/translations/gl.po
  4. 2 2
      packages/ckeditor5-table/lang/translations/hu.po
  5. 2 2
      packages/ckeditor5-table/lang/translations/tr.po
  6. 78 0
      packages/ckeditor5-table/lang/translations/vi.po
  7. 17 17
      packages/ckeditor5-table/package.json
  8. 1 2
      packages/ckeditor5-table/src/commands/insertcolumncommand.js
  9. 1 2
      packages/ckeditor5-table/src/commands/insertrowcommand.js
  10. 1 2
      packages/ckeditor5-table/src/commands/inserttablecommand.js
  11. 1 2
      packages/ckeditor5-table/src/commands/mergecellcommand.js
  12. 1 2
      packages/ckeditor5-table/src/commands/removecolumncommand.js
  13. 1 2
      packages/ckeditor5-table/src/commands/splitcellcommand.js
  14. 21 17
      packages/ckeditor5-table/src/converters/downcast.js
  15. 6 6
      packages/ckeditor5-table/src/tableediting.js
  16. 4 1
      packages/ckeditor5-table/src/utils.js
  17. 3 11
      packages/ckeditor5-table/tests/_utils/utils.js
  18. 40 0
      packages/ckeditor5-table/tests/converters/downcast.js
  19. 3 4
      packages/ckeditor5-table/tests/converters/upcasttable.js
  20. 1 4
      packages/ckeditor5-table/tests/manual/table.js
  21. 12 0
      packages/ckeditor5-table/tests/manual/tableblockcontent.html
  22. 4 3
      packages/ckeditor5-table/tests/manual/tableblockcontent.js
  23. 1 0
      packages/ckeditor5-table/tests/manual/tableblockcontent.md
  24. 51 2
      packages/ckeditor5-table/tests/tableediting.js
  25. 37 1
      packages/ckeditor5-table/tests/tabletoolbar.js

+ 13 - 0
packages/ckeditor5-table/CHANGELOG.md

@@ -1,6 +1,19 @@
 Changelog
 Changelog
 =========
 =========
 
 
+## [11.0.1](https://github.com/ckeditor/ckeditor5-table/compare/v11.0.0...v11.0.1) (2018-12-05)
+
+### Bug fixes
+
+* Skip text nodes between `<tr>` elements during table upcast. Closes [#145](https://github.com/ckeditor/ckeditor5-table/issues/145). ([2ecf448](https://github.com/ckeditor/ckeditor5-table/commit/2ecf448))
+
+### Other changes
+
+* Changed labels and command names for the insert column functionality for better UX and translatability. Closes [#138](https://github.com/ckeditor/ckeditor5-table/issues/138). ([fd2221f](https://github.com/ckeditor/ckeditor5-table/commit/fd2221f))
+* Improved SVG icons size. See [ckeditor/ckeditor5-theme-lark#206](https://github.com/ckeditor/ckeditor5-theme-lark/issues/206). ([23d6803](https://github.com/ckeditor/ckeditor5-table/commit/23d6803))
+* Updated translations. ([47475b2](https://github.com/ckeditor/ckeditor5-table/commit/47475b2)) ([5d39d35](https://github.com/ckeditor/ckeditor5-table/commit/5d39d35)) ([7ce6d5b](https://github.com/ckeditor/ckeditor5-table/commit/7ce6d5b)) ([268f607](https://github.com/ckeditor/ckeditor5-table/commit/268f607))
+
+
 ## [11.0.0](https://github.com/ckeditor/ckeditor5-table/compare/v10.1.0...v11.0.0) (2018-10-08)
 ## [11.0.0](https://github.com/ckeditor/ckeditor5-table/compare/v10.1.0...v11.0.0) (2018-10-08)
 
 
 ### Features
 ### Features

+ 8 - 8
packages/ckeditor5-table/lang/translations/fr.po

@@ -15,11 +15,11 @@ msgstr "Colonne d'entête"
 
 
 msgctxt "Label for the insert table column to the left of the current one button."
 msgctxt "Label for the insert table column to the left of the current one button."
 msgid "Insert column left"
 msgid "Insert column left"
-msgstr ""
+msgstr "Insérer une colonne à gauche"
 
 
 msgctxt "Label for the insert table column to the right of the current one button."
 msgctxt "Label for the insert table column to the right of the current one button."
 msgid "Insert column right"
 msgid "Insert column right"
-msgstr ""
+msgstr "Insérer une colonne à droite"
 
 
 msgctxt "Label for the delete table column button."
 msgctxt "Label for the delete table column button."
 msgid "Delete column"
 msgid "Delete column"
@@ -31,15 +31,15 @@ msgstr "Colonne"
 
 
 msgctxt "Label for the set/unset table header row button."
 msgctxt "Label for the set/unset table header row button."
 msgid "Header row"
 msgid "Header row"
-msgstr "Rangée d'entête"
+msgstr "Ligne d'entête"
 
 
 msgctxt "Label for the insert row below button."
 msgctxt "Label for the insert row below button."
 msgid "Insert row below"
 msgid "Insert row below"
-msgstr "Insérer une rangée en-dessous"
+msgstr "Insérer une ligne en-dessous"
 
 
 msgctxt "Label for the insert row above button."
 msgctxt "Label for the insert row above button."
 msgid "Insert row above"
 msgid "Insert row above"
-msgstr "Insérer une rangée au-dessus"
+msgstr "Insérer une ligne au-dessus"
 
 
 msgctxt "Label for the delete table row button."
 msgctxt "Label for the delete table row button."
 msgid "Delete row"
 msgid "Delete row"
@@ -47,7 +47,7 @@ msgstr "Supprimer la rangée"
 
 
 msgctxt "Label for the table row dropdown button."
 msgctxt "Label for the table row dropdown button."
 msgid "Row"
 msgid "Row"
-msgstr "Rangée"
+msgstr "Ligne"
 
 
 msgctxt "Label for the merge table cell up button."
 msgctxt "Label for the merge table cell up button."
 msgid "Merge cell up"
 msgid "Merge cell up"
@@ -67,11 +67,11 @@ msgstr "Fusionner la cellule à gauche"
 
 
 msgctxt "Label for the split table cell vertically button."
 msgctxt "Label for the split table cell vertically button."
 msgid "Split cell vertically"
 msgid "Split cell vertically"
-msgstr "Séparer la cellule verticalement"
+msgstr "Scinder la cellule verticalement"
 
 
 msgctxt "Label for the split table cell horizontally button."
 msgctxt "Label for the split table cell horizontally button."
 msgid "Split cell horizontally"
 msgid "Split cell horizontally"
-msgstr "Séparer la cellule horizontalement"
+msgstr "Scinder la cellule horizontalement"
 
 
 msgctxt "Label for the merge table cells button."
 msgctxt "Label for the merge table cells button."
 msgid "Merge cells"
 msgid "Merge cells"

+ 2 - 2
packages/ckeditor5-table/lang/translations/gl.po

@@ -15,11 +15,11 @@ msgstr "Cabeceira de columna"
 
 
 msgctxt "Label for the insert table column to the left of the current one button."
 msgctxt "Label for the insert table column to the left of the current one button."
 msgid "Insert column left"
 msgid "Insert column left"
-msgstr ""
+msgstr "Inserir columna á esquerda"
 
 
 msgctxt "Label for the insert table column to the right of the current one button."
 msgctxt "Label for the insert table column to the right of the current one button."
 msgid "Insert column right"
 msgid "Insert column right"
-msgstr ""
+msgstr "Inserir columna á dereita"
 
 
 msgctxt "Label for the delete table column button."
 msgctxt "Label for the delete table column button."
 msgid "Delete column"
 msgid "Delete column"

+ 2 - 2
packages/ckeditor5-table/lang/translations/hu.po

@@ -15,11 +15,11 @@ msgstr "Oszlop fejléc"
 
 
 msgctxt "Label for the insert table column to the left of the current one button."
 msgctxt "Label for the insert table column to the left of the current one button."
 msgid "Insert column left"
 msgid "Insert column left"
-msgstr ""
+msgstr "Oszlop beszúrása balra"
 
 
 msgctxt "Label for the insert table column to the right of the current one button."
 msgctxt "Label for the insert table column to the right of the current one button."
 msgid "Insert column right"
 msgid "Insert column right"
-msgstr ""
+msgstr "Oszlop beszúrása jobbra"
 
 
 msgctxt "Label for the delete table column button."
 msgctxt "Label for the delete table column button."
 msgid "Delete column"
 msgid "Delete column"

+ 2 - 2
packages/ckeditor5-table/lang/translations/tr.po

@@ -15,11 +15,11 @@ msgstr "Başlık kolonu"
 
 
 msgctxt "Label for the insert table column to the left of the current one button."
 msgctxt "Label for the insert table column to the left of the current one button."
 msgid "Insert column left"
 msgid "Insert column left"
-msgstr ""
+msgstr "Sola kolon ekle"
 
 
 msgctxt "Label for the insert table column to the right of the current one button."
 msgctxt "Label for the insert table column to the right of the current one button."
 msgid "Insert column right"
 msgid "Insert column right"
-msgstr ""
+msgstr "Sağa kolon ekle"
 
 
 msgctxt "Label for the delete table column button."
 msgctxt "Label for the delete table column button."
 msgid "Delete column"
 msgid "Delete column"

+ 78 - 0
packages/ckeditor5-table/lang/translations/vi.po

@@ -0,0 +1,78 @@
+# Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+msgid ""
+msgstr ""
+"Language-Team: Vietnamese (https://www.transifex.com/ckeditor/teams/11143/vi/)\n"
+"Language: vi\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+msgctxt "Label for the insert table toolbar button."
+msgid "Insert table"
+msgstr "Tạo bảng"
+
+msgctxt "Label for the set/unset table header column button."
+msgid "Header column"
+msgstr "Tiêu đề cột"
+
+msgctxt "Label for the insert table column to the left of the current one button."
+msgid "Insert column left"
+msgstr "Thêm cột vào bên trái"
+
+msgctxt "Label for the insert table column to the right of the current one button."
+msgid "Insert column right"
+msgstr "Thêm cột vào bên phải"
+
+msgctxt "Label for the delete table column button."
+msgid "Delete column"
+msgstr "Xoá cột"
+
+msgctxt "Label for the table column dropdown button."
+msgid "Column"
+msgstr "Cột"
+
+msgctxt "Label for the set/unset table header row button."
+msgid "Header row"
+msgstr "Tiêu đề hàng"
+
+msgctxt "Label for the insert row below button."
+msgid "Insert row below"
+msgstr "Thêm hàng ở dưới"
+
+msgctxt "Label for the insert row above button."
+msgid "Insert row above"
+msgstr "Thêm hàng phía trên"
+
+msgctxt "Label for the delete table row button."
+msgid "Delete row"
+msgstr "Xoá hàng"
+
+msgctxt "Label for the table row dropdown button."
+msgid "Row"
+msgstr "Hàng"
+
+msgctxt "Label for the merge table cell up button."
+msgid "Merge cell up"
+msgstr ""
+
+msgctxt "Label for the merge table cell right button."
+msgid "Merge cell right"
+msgstr ""
+
+msgctxt "Label for the merge table cell down button."
+msgid "Merge cell down"
+msgstr ""
+
+msgctxt "Label for the merge table cell left button."
+msgid "Merge cell left"
+msgstr ""
+
+msgctxt "Label for the split table cell vertically button."
+msgid "Split cell vertically"
+msgstr ""
+
+msgctxt "Label for the split table cell horizontally button."
+msgid "Split cell horizontally"
+msgstr ""
+
+msgctxt "Label for the merge table cells button."
+msgid "Merge cells"
+msgstr ""

+ 17 - 17
packages/ckeditor5-table/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@ckeditor/ckeditor5-table",
   "name": "@ckeditor/ckeditor5-table",
-  "version": "11.0.0",
+  "version": "11.0.1",
   "description": "Table feature for CKEditor 5.",
   "description": "Table feature for CKEditor 5.",
   "keywords": [
   "keywords": [
     "ckeditor",
     "ckeditor",
@@ -10,25 +10,25 @@
     "ckeditor5-plugin"
     "ckeditor5-plugin"
   ],
   ],
   "dependencies": {
   "dependencies": {
-    "@ckeditor/ckeditor5-core": "^11.0.1",
-    "@ckeditor/ckeditor5-engine": "^11.0.0",
-    "@ckeditor/ckeditor5-ui": "^11.1.0",
-    "@ckeditor/ckeditor5-widget": "^10.3.0"
+    "@ckeditor/ckeditor5-core": "^11.1.0",
+    "@ckeditor/ckeditor5-ui": "^11.2.0",
+    "@ckeditor/ckeditor5-widget": "^10.3.1"
   },
   },
   "devDependencies": {
   "devDependencies": {
-    "@ckeditor/ckeditor5-alignment": "^10.0.3",
-    "@ckeditor/ckeditor5-block-quote": "^10.1.0",
-    "@ckeditor/ckeditor5-clipboard": "^10.0.3",
-    "@ckeditor/ckeditor5-editor-classic": "^11.0.1",
-    "@ckeditor/ckeditor5-image": "^11.0.0",
-    "@ckeditor/ckeditor5-list": "^11.0.2",
-    "@ckeditor/ckeditor5-media-embed": "^10.0.0",
-    "@ckeditor/ckeditor5-paragraph": "^10.0.3",
-    "@ckeditor/ckeditor5-typing": "^11.0.1",
-    "@ckeditor/ckeditor5-undo": "^10.0.3",
-    "@ckeditor/ckeditor5-utils": "^11.0.0",
+    "@ckeditor/ckeditor5-alignment": "^10.0.4",
+    "@ckeditor/ckeditor5-block-quote": "^10.1.1",
+    "@ckeditor/ckeditor5-clipboard": "^10.0.4",
+    "@ckeditor/ckeditor5-editor-classic": "^11.0.2",
+    "@ckeditor/ckeditor5-engine": "^12.0.0",
+    "@ckeditor/ckeditor5-image": "^12.0.0",
+    "@ckeditor/ckeditor5-list": "^11.0.3",
+    "@ckeditor/ckeditor5-media-embed": "^10.1.0",
+    "@ckeditor/ckeditor5-paragraph": "^10.0.4",
+    "@ckeditor/ckeditor5-typing": "^11.0.2",
+    "@ckeditor/ckeditor5-undo": "^10.0.4",
+    "@ckeditor/ckeditor5-utils": "^11.1.0",
     "eslint": "^5.5.0",
     "eslint": "^5.5.0",
-    "eslint-config-ckeditor5": "^1.0.7",
+    "eslint-config-ckeditor5": "^1.0.9",
     "husky": "^0.14.3",
     "husky": "^0.14.3",
     "lint-staged": "^7.0.0"
     "lint-staged": "^7.0.0"
   },
   },

+ 1 - 2
packages/ckeditor5-table/src/commands/insertcolumncommand.js

@@ -9,7 +9,6 @@
 
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findAncestor } from './utils';
 import { findAncestor } from './utils';
-import TableUtils from '../tableutils';
 
 
 /**
 /**
  * The insert column command.
  * The insert column command.
@@ -70,7 +69,7 @@ export default class InsertColumnCommand extends Command {
 	execute() {
 	execute() {
 		const editor = this.editor;
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 
 		const firstPosition = selection.getFirstPosition();
 		const firstPosition = selection.getFirstPosition();
 
 

+ 1 - 2
packages/ckeditor5-table/src/commands/insertrowcommand.js

@@ -9,7 +9,6 @@
 
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findAncestor } from './utils';
 import { findAncestor } from './utils';
-import TableUtils from '../tableutils';
 
 
 /**
 /**
  * The insert row command.
  * The insert row command.
@@ -69,7 +68,7 @@ export default class InsertRowCommand extends Command {
 	execute() {
 	execute() {
 		const editor = this.editor;
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 		const tableRow = tableCell.parent;
 		const tableRow = tableCell.parent;

+ 1 - 2
packages/ckeditor5-table/src/commands/inserttablecommand.js

@@ -9,7 +9,6 @@
 
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
 import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
-import TableUtils from '../tableutils';
 
 
 /**
 /**
  * The insert table command.
  * The insert table command.
@@ -49,7 +48,7 @@ export default class InsertTableCommand extends Command {
 	execute( options = {} ) {
 	execute( options = {} ) {
 		const model = this.editor.model;
 		const model = this.editor.model;
 		const selection = model.document.selection;
 		const selection = model.document.selection;
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 
 		const rows = parseInt( options.rows ) || 2;
 		const rows = parseInt( options.rows ) || 2;
 		const columns = parseInt( options.columns ) || 2;
 		const columns = parseInt( options.columns ) || 2;

+ 1 - 2
packages/ckeditor5-table/src/commands/mergecellcommand.js

@@ -10,7 +10,6 @@
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import TableWalker from '../tablewalker';
 import TableWalker from '../tablewalker';
 import { findAncestor, updateNumericAttribute } from './utils';
 import { findAncestor, updateNumericAttribute } from './utils';
-import TableUtils from '../tableutils';
 
 
 /**
 /**
  * The merge cell command.
  * The merge cell command.
@@ -127,7 +126,7 @@ export default class MergeCellCommand extends Command {
 			return;
 			return;
 		}
 		}
 
 
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 
 		// First get the cell on proper direction.
 		// First get the cell on proper direction.
 		const cellToMerge = this.isHorizontal ?
 		const cellToMerge = this.isHorizontal ?

+ 1 - 2
packages/ckeditor5-table/src/commands/removecolumncommand.js

@@ -10,7 +10,6 @@
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
 
 import TableWalker from '../tablewalker';
 import TableWalker from '../tablewalker';
-import TableUtils from '../tableutils';
 import { findAncestor, updateNumericAttribute } from './utils';
 import { findAncestor, updateNumericAttribute } from './utils';
 
 
 /**
 /**
@@ -31,7 +30,7 @@ export default class RemoveColumnCommand extends Command {
 	refresh() {
 	refresh() {
 		const editor = this.editor;
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 
 

+ 1 - 2
packages/ckeditor5-table/src/commands/splitcellcommand.js

@@ -8,7 +8,6 @@
  */
  */
 
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import Command from '@ckeditor/ckeditor5-core/src/command';
-import TableUtils from '../tableutils';
 import { findAncestor } from './utils';
 import { findAncestor } from './utils';
 
 
 /**
 /**
@@ -68,7 +67,7 @@ export default class SplitCellCommand extends Command {
 
 
 		const isHorizontally = this.direction === 'horizontally';
 		const isHorizontally = this.direction === 'horizontally';
 
 
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 
 		if ( isHorizontally ) {
 		if ( isHorizontally ) {
 			tableUtils.splitCellHorizontally( tableCell, 2 );
 			tableUtils.splitCellHorizontally( tableCell, 2 );

+ 21 - 17
packages/ckeditor5-table/src/converters/downcast.js

@@ -51,14 +51,17 @@ export function downcastInsertTable( options = {} ) {
 			headingColumns: table.getAttribute( 'headingColumns' ) || 0
 			headingColumns: table.getAttribute( 'headingColumns' ) || 0
 		};
 		};
 
 
+		// Cache for created table rows.
+		const viewRows = new Map();
+
 		for ( const tableWalkerValue of tableWalker ) {
 		for ( const tableWalkerValue of tableWalker ) {
 			const { row, cell } = tableWalkerValue;
 			const { row, cell } = tableWalkerValue;
 
 
 			const tableSection = getOrCreateTableSection( getSectionName( row, tableAttributes ), tableElement, conversionApi );
 			const tableSection = getOrCreateTableSection( getSectionName( row, tableAttributes ), tableElement, conversionApi );
 			const tableRow = table.getChild( row );
 			const tableRow = table.getChild( row );
 
 
-			// Check if row was converted
-			const trElement = getOrCreateTr( tableRow, row, tableSection, conversionApi );
+			const trElement = viewRows.get( row ) || createTr( tableRow, row, tableSection, conversionApi );
+			viewRows.set( row, trElement );
 
 
 			// Consume table cell - it will be always consumed as we convert whole table at once.
 			// Consume table cell - it will be always consumed as we convert whole table at once.
 			conversionApi.consumable.consume( cell, 'insert' );
 			conversionApi.consumable.consume( cell, 'insert' );
@@ -104,9 +107,14 @@ export function downcastInsertRow( options = {} ) {
 			headingColumns: table.getAttribute( 'headingColumns' ) || 0
 			headingColumns: table.getAttribute( 'headingColumns' ) || 0
 		};
 		};
 
 
+		// Cache for created table rows.
+		const viewRows = new Map();
+
 		for ( const tableWalkerValue of tableWalker ) {
 		for ( const tableWalkerValue of tableWalker ) {
 			const tableSection = getOrCreateTableSection( getSectionName( row, tableAttributes ), tableElement, conversionApi );
 			const tableSection = getOrCreateTableSection( getSectionName( row, tableAttributes ), tableElement, conversionApi );
-			const trElement = getOrCreateTr( tableRow, row, tableSection, conversionApi );
+
+			const trElement = viewRows.get( row ) || createTr( tableRow, row, tableSection, conversionApi );
+			viewRows.set( row, trElement );
 
 
 			// Consume table cell - it will be always consumed as we convert whole row at once.
 			// Consume table cell - it will be always consumed as we convert whole row at once.
 			conversionApi.consumable.consume( tableWalkerValue.cell, 'insert' );
 			conversionApi.consumable.consume( tableWalkerValue.cell, 'insert' );
@@ -404,29 +412,25 @@ function createViewTableCellElement( tableWalkerValue, tableAttributes, insertPo
 	}
 	}
 }
 }
 
 
-// Creates or returns an existing `<tr>` element from the view.
+// Creates `<tr>` view element.
 //
 //
 // @param {module:engine/view/element~Element} tableRow
 // @param {module:engine/view/element~Element} tableRow
 // @param {Number} rowIndex
 // @param {Number} rowIndex
 // @param {module:engine/view/element~Element} tableSection
 // @param {module:engine/view/element~Element} tableSection
 // @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
 // @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi
 // @returns {module:engine/view/element~Element}
 // @returns {module:engine/view/element~Element}
-function getOrCreateTr( tableRow, rowIndex, tableSection, conversionApi ) {
-	let trElement = conversionApi.mapper.toViewElement( tableRow );
+function createTr( tableRow, rowIndex, tableSection, conversionApi ) {
+	// Will always consume since we're converting <tableRow> element from a parent <table>.
+	conversionApi.consumable.consume( tableRow, 'insert' );
 
 
-	if ( !trElement ) {
-		// Will always consume since we're converting <tableRow> element from a parent <table>.
-		conversionApi.consumable.consume( tableRow, 'insert' );
+	const trElement = conversionApi.writer.createContainerElement( 'tr' );
+	conversionApi.mapper.bindElements( tableRow, trElement );
 
 
-		trElement = conversionApi.writer.createContainerElement( 'tr' );
-		conversionApi.mapper.bindElements( tableRow, trElement );
+	const headingRows = tableRow.parent.getAttribute( 'headingRows' ) || 0;
+	const offset = headingRows > 0 && rowIndex >= headingRows ? rowIndex - headingRows : rowIndex;
 
 
-		const headingRows = tableRow.parent.getAttribute( 'headingRows' ) || 0;
-		const offset = headingRows > 0 && rowIndex >= headingRows ? rowIndex - headingRows : rowIndex;
-
-		const position = conversionApi.writer.createPositionAt( tableSection, offset );
-		conversionApi.writer.insert( position, trElement );
-	}
+	const position = conversionApi.writer.createPositionAt( tableSection, offset );
+	conversionApi.writer.insert( position, trElement );
 
 
 	return trElement;
 	return trElement;
 }
 }

+ 6 - 6
packages/ckeditor5-table/src/tableediting.js

@@ -8,7 +8,6 @@
  */
  */
 
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 
 
 import upcastTable, { upcastTableCell } from './converters/upcasttable';
 import upcastTable, { upcastTableCell } from './converters/upcasttable';
 import {
 import {
@@ -57,7 +56,8 @@ export default class TableEditing extends Plugin {
 			allowWhere: '$block',
 			allowWhere: '$block',
 			allowAttributes: [ 'headingRows', 'headingColumns' ],
 			allowAttributes: [ 'headingRows', 'headingColumns' ],
 			isLimit: true,
 			isLimit: true,
-			isObject: true
+			isObject: true,
+			isBlock: true
 		} );
 		} );
 
 
 		schema.register( 'tableRow', {
 		schema.register( 'tableRow', {
@@ -81,13 +81,13 @@ export default class TableEditing extends Plugin {
 			}
 			}
 		} );
 		} );
 
 
-		// Disallow image and media in table cell.
+		// Disallow media in table cell.
 		schema.addChildCheck( ( context, childDefinition ) => {
 		schema.addChildCheck( ( context, childDefinition ) => {
 			if ( !Array.from( context.getNames() ).includes( 'table' ) ) {
 			if ( !Array.from( context.getNames() ).includes( 'table' ) ) {
 				return;
 				return;
 			}
 			}
 
 
-			if ( childDefinition.name == 'image' || childDefinition.name == 'media' ) {
+			if ( childDefinition.name == 'media' ) {
 				return false;
 				return false;
 			}
 			}
 		} );
 		} );
@@ -99,7 +99,7 @@ export default class TableEditing extends Plugin {
 		conversion.for( 'dataDowncast' ).add( downcastInsertTable() );
 		conversion.for( 'dataDowncast' ).add( downcastInsertTable() );
 
 
 		// Table row conversion.
 		// Table row conversion.
-		conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableRow', view: 'tr' } ) );
+		conversion.for( 'upcast' ).elementToElement( { model: 'tableRow', view: 'tr' } );
 
 
 		conversion.for( 'editingDowncast' ).add( downcastInsertRow( { asWidget: true } ) );
 		conversion.for( 'editingDowncast' ).add( downcastInsertRow( { asWidget: true } ) );
 		conversion.for( 'dataDowncast' ).add( downcastInsertRow() );
 		conversion.for( 'dataDowncast' ).add( downcastInsertRow() );
@@ -228,7 +228,7 @@ export default class TableEditing extends Plugin {
 			const isLastRow = currentRowIndex === table.childCount - 1;
 			const isLastRow = currentRowIndex === table.childCount - 1;
 
 
 			if ( isForward && isLastRow && isLastCellInRow ) {
 			if ( isForward && isLastRow && isLastCellInRow ) {
-				editor.plugins.get( TableUtils ).insertRows( table, { at: table.childCount } );
+				editor.plugins.get( 'TableUtils' ).insertRows( table, { at: table.childCount } );
 			}
 			}
 
 
 			let cellToFocus;
 			let cellToFocus;

+ 4 - 1
packages/ckeditor5-table/src/utils.js

@@ -57,7 +57,10 @@ export function isTableWidgetSelected( selection ) {
  * @returns {Boolean}
  * @returns {Boolean}
  */
  */
 export function isTableContentSelected( selection ) {
 export function isTableContentSelected( selection ) {
+	const selectedElement = selection.getSelectedElement();
+	const isInnerWidgetSelected = selectedElement && isWidget( selectedElement );
+
 	const parentTable = findAncestor( 'table', selection.getFirstPosition() );
 	const parentTable = findAncestor( 'table', selection.getFirstPosition() );
 
 
-	return !!( parentTable && isTableWidget( parentTable.parent ) );
+	return !isInnerWidgetSelected && !!( parentTable && isTableWidget( parentTable.parent ) );
 }
 }

+ 3 - 11
packages/ckeditor5-table/tests/_utils/utils.js

@@ -3,8 +3,6 @@
  * For licensing, see LICENSE.md.
  * For licensing, see LICENSE.md.
  */
  */
 
 
-import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
-
 import {
 import {
 	downcastInsertCell,
 	downcastInsertCell,
 	downcastInsertRow,
 	downcastInsertRow,
@@ -163,7 +161,8 @@ export function defaultSchema( schema, registerParagraph = true ) {
 		allowWhere: '$block',
 		allowWhere: '$block',
 		allowAttributes: [ 'headingRows', 'headingColumns' ],
 		allowAttributes: [ 'headingRows', 'headingColumns' ],
 		isLimit: true,
 		isLimit: true,
-		isObject: true
+		isObject: true,
+		isBlock: true
 	} );
 	} );
 
 
 	schema.register( 'tableRow', {
 	schema.register( 'tableRow', {
@@ -187,13 +186,6 @@ export function defaultSchema( schema, registerParagraph = true ) {
 		}
 		}
 	} );
 	} );
 
 
-	// Disallow image in table.
-	schema.addChildCheck( ( context, childDefinition ) => {
-		if ( childDefinition.name == 'image' && Array.from( context.getNames() ).includes( 'table' ) ) {
-			return false;
-		}
-	} );
-
 	if ( registerParagraph ) {
 	if ( registerParagraph ) {
 		schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 		schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 	}
 	}
@@ -207,7 +199,7 @@ export function defaultConversion( conversion, asWidget = false ) {
 	conversion.for( 'downcast' ).add( downcastInsertTable( { asWidget } ) );
 	conversion.for( 'downcast' ).add( downcastInsertTable( { asWidget } ) );
 
 
 	// Table row conversion.
 	// Table row conversion.
-	conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableRow', view: 'tr' } ) );
+	conversion.for( 'upcast' ).elementToElement( { model: 'tableRow', view: 'tr' } );
 	conversion.for( 'downcast' ).add( downcastInsertRow( { asWidget } ) );
 	conversion.for( 'downcast' ).add( downcastInsertRow( { asWidget } ) );
 	conversion.for( 'downcast' ).add( downcastRemoveRow( { asWidget } ) );
 	conversion.for( 'downcast' ).add( downcastRemoveRow( { asWidget } ) );
 
 

+ 40 - 0
packages/ckeditor5-table/tests/converters/downcast.js

@@ -171,6 +171,46 @@ describe( 'downcast converters', () => {
 			) );
 			) );
 		} );
 		} );
 
 
+		it( 'should re-create table on reinsert', () => {
+			model.schema.register( 'wrapper', {
+				allowWhere: '$block',
+				allowContentOf: '$root'
+			} );
+			editor.conversion.elementToElement( { model: 'wrapper', view: 'div' } );
+
+			setModelData( model, modelTable( [ [ '[]' ] ] ) );
+
+			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				'<figure class="table">' +
+					'<table>' +
+						'<tbody>' +
+							'<tr><td></td></tr>' +
+						'</tbody>' +
+					'</table>' +
+				'</figure>'
+			) );
+
+			model.change( writer => {
+				const table = model.document.getRoot().getChild( 0 );
+				const range = writer.createRange( writer.createPositionBefore( table ), writer.createPositionAfter( table ) );
+				const wrapper = writer.createElement( 'wrapper' );
+
+				writer.wrap( range, wrapper );
+			} );
+
+			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				'<div>' +
+					'<figure class="table">' +
+						'<table>' +
+							'<tbody>' +
+								'<tr><td></td></tr>' +
+							'</tbody>' +
+						'</table>' +
+					'</figure>' +
+				'</div>'
+			) );
+		} );
+
 		describe( 'headingColumns attribute', () => {
 		describe( 'headingColumns attribute', () => {
 			it( 'should mark heading columns table cells', () => {
 			it( 'should mark heading columns table cells', () => {
 				setModelData( model, modelTable( [
 				setModelData( model, modelTable( [

+ 3 - 4
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -4,7 +4,6 @@
  */
  */
 
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
-import { upcastElementToElement } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
@@ -211,7 +210,7 @@ describe( 'upcastTable()', () => {
 		editor.model.schema.register( 'div', {
 		editor.model.schema.register( 'div', {
 			inheritAllFrom: '$block'
 			inheritAllFrom: '$block'
 		} );
 		} );
-		editor.conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'div', view: 'div' } ) );
+		editor.conversion.for( 'upcast' ).elementToElement( { model: 'div', view: 'div' } );
 
 
 		editor.setData(
 		editor.setData(
 			'<div>foo' +
 			'<div>foo' +
@@ -457,7 +456,7 @@ describe( 'upcastTable()', () => {
 			] ) );
 			] ) );
 		} );
 		} );
 
 
-		it( 'should upcast table with <img> in table cell to empty table cell', () => {
+		it( 'should upcast table with <img> in table cell', () => {
 			editor.setData(
 			editor.setData(
 				'<table>' +
 				'<table>' +
 					'<tbody>' +
 					'<tbody>' +
@@ -469,7 +468,7 @@ describe( 'upcastTable()', () => {
 			);
 			);
 
 
 			expectModel( modelTable( [
 			expectModel( modelTable( [
-				[ '' ]
+				[ '<image src="sample.png"></image>' ]
 			] ) );
 			] ) );
 		} );
 		} );
 	} );
 	} );

+ 1 - 4
packages/ckeditor5-table/tests/manual/table.js

@@ -7,13 +7,10 @@
 
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
-import Table from '../../src/table';
-import TableToolbar from '../../src/tabletoolbar';
-import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
 
 
 ClassicEditor
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ ArticlePluginSet, Table, TableToolbar, BlockQuote ],
+		plugins: [ ArticlePluginSet ],
 		toolbar: [
 		toolbar: [
 			'heading', '|', 'insertTable', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
 			'heading', '|', 'insertTable', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo'
 		],
 		],

+ 12 - 0
packages/ckeditor5-table/tests/manual/tableblockcontent.html

@@ -64,6 +64,18 @@
 			</td>
 			</td>
 			<td><blockquote><p style="text-align: right">A quote with paragraph with right alignment</p></blockquote></td>
 			<td><blockquote><p style="text-align: right">A quote with paragraph with right alignment</p></blockquote></td>
 		</tr>
 		</tr>
+		<tr>
+			<td>image</td>
+			<td>
+				<img alt="sample image" src="sample.jpg">
+			</td>
+			<td>
+				<p>An image aligned to right:</p>
+				<figure class="image image-style-side" contenteditable="false">
+					<img src="sample.jpg" alt="sample image">
+				</figure>
+			</td>
+		</tr>
 		</tbody>
 		</tbody>
 	</table>
 	</table>
 </div>
 </div>

+ 4 - 3
packages/ckeditor5-table/tests/manual/tableblockcontent.js

@@ -7,17 +7,18 @@
 
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
-import Table from '../../src/table';
-import TableToolbar from '../../src/tabletoolbar';
 import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
 import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
 
 
 ClassicEditor
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ ArticlePluginSet, Table, TableToolbar, Alignment ],
+		plugins: [ ArticlePluginSet, Alignment ],
 		toolbar: [
 		toolbar: [
 			'heading', '|', 'insertTable', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote',
 			'heading', '|', 'insertTable', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote',
 			'alignment', '|', 'undo', 'redo'
 			'alignment', '|', 'undo', 'redo'
 		],
 		],
+		image: {
+			toolbar: [ 'imageStyle:full', 'imageStyle:side' ]
+		},
 		table: {
 		table: {
 			contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
 			contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
 		}
 		}

+ 1 - 0
packages/ckeditor5-table/tests/manual/tableblockcontent.md

@@ -6,6 +6,7 @@
     * List
     * List
     * Heading
     * Heading
     * Block Quote (with inner paragraph)
     * Block Quote (with inner paragraph)
+    * Image
 
 
 2. The third column consist blocks with text alignment.
 2. The third column consist blocks with text alignment.
     * Paragraph - should be rendered was `<p>` when alignment is set (apart from default) for single paragraph.
     * Paragraph - should be rendered was `<p>` when alignment is set (apart from default) for single paragraph.

+ 51 - 2
packages/ckeditor5-table/tests/tableediting.js

@@ -45,6 +45,7 @@ describe( 'TableEditing', () => {
 		// Table:
 		// Table:
 		expect( model.schema.isRegistered( 'table' ) ).to.be.true;
 		expect( model.schema.isRegistered( 'table' ) ).to.be.true;
 		expect( model.schema.isObject( 'table' ) ).to.be.true;
 		expect( model.schema.isObject( 'table' ) ).to.be.true;
+		expect( model.schema.isBlock( 'table' ) ).to.be.true;
 		expect( model.schema.isLimit( 'table' ) ).to.be.true;
 		expect( model.schema.isLimit( 'table' ) ).to.be.true;
 
 
 		expect( model.schema.checkChild( [ '$root' ], 'table' ) ).to.be.true;
 		expect( model.schema.checkChild( [ '$root' ], 'table' ) ).to.be.true;
@@ -74,7 +75,7 @@ describe( 'TableEditing', () => {
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$text' ) ).to.be.false;
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$text' ) ).to.be.false;
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$block' ) ).to.be.true;
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], '$block' ) ).to.be.true;
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'table' ) ).to.be.false;
 		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'table' ) ).to.be.false;
-		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'image' ) ).to.be.false;
+		expect( model.schema.checkChild( [ '$root', 'table', 'tableRow', 'tableCell' ], 'image' ) ).to.be.true;
 	} );
 	} );
 
 
 	it( 'adds insertTable command', () => {
 	it( 'adds insertTable command', () => {
@@ -183,7 +184,7 @@ describe( 'TableEditing', () => {
 				editor.setData( '<table><tbody><tr><td><img src="sample.png"></td></tr></tbody></table>' );
 				editor.setData( '<table><tbody><tr><td><img src="sample.png"></td></tr></tbody></table>' );
 
 
 				expect( getModelData( model, { withoutSelection: true } ) )
 				expect( getModelData( model, { withoutSelection: true } ) )
-					.to.equal( '<table><tableRow><tableCell><paragraph></paragraph></tableCell></tableRow></table>' );
+					.to.equal( '<table><tableRow><tableCell><image src="sample.png"></image></tableCell></tableRow></table>' );
 			} );
 			} );
 
 
 			it( 'should convert table with media', () => {
 			it( 'should convert table with media', () => {
@@ -312,6 +313,40 @@ describe( 'TableEditing', () => {
 				] ) );
 				] ) );
 			} );
 			} );
 
 
+			it( 'should move to next cell with an image', () => {
+				setModelData( model, modelTable( [
+					[ '11[]', '<paragraph>foo</paragraph><image></image>' ]
+				] ) );
+
+				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
+
+				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
+				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
+				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+					[ '11', '<paragraph>[foo</paragraph><image></image>]' ]
+				] ) );
+			} );
+
+			it( 'should move to next cell with an blockQuote', () => {
+				model.schema.register( 'blockQuote', {
+					allowWhere: '$block',
+					allowContentOf: '$root'
+				} );
+				editor.conversion.elementToElement( { model: 'blockQuote', view: 'blockquote' } );
+
+				setModelData( model, modelTable( [
+					[ '11[]', '<blockQuote><paragraph>foo</paragraph></blockQuote>' ]
+				] ) );
+
+				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
+
+				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
+				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
+				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+					[ '11', '<blockQuote><paragraph>[foo]</paragraph></blockQuote>' ]
+				] ) );
+			} );
+
 			it( 'should listen with lower priority then its children', () => {
 			it( 'should listen with lower priority then its children', () => {
 				// Cancel TAB event.
 				// Cancel TAB event.
 				editor.keystrokes.set( 'Tab', ( data, cancel ) => cancel() );
 				editor.keystrokes.set( 'Tab', ( data, cancel ) => cancel() );
@@ -461,6 +496,20 @@ describe( 'TableEditing', () => {
 					],
 					],
 				] ) );
 				] ) );
 			} );
 			} );
+
+			it( 'should move to previous cell with an image', () => {
+				setModelData( model, modelTable( [
+					[ '<paragraph>foo</paragraph><image></image>', 'bar[]' ]
+				] ) );
+
+				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
+
+				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
+				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
+				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+					[ '<paragraph>[foo</paragraph><image></image>]', 'bar' ]
+				] ) );
+			} );
 		} );
 		} );
 	} );
 	} );
 
 

+ 37 - 1
packages/ckeditor5-table/tests/tabletoolbar.js

@@ -16,6 +16,9 @@ import View from '@ckeditor/ckeditor5-ui/src/view';
 import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import WidgetToolbarRepository from '@ckeditor/ckeditor5-widget/src/widgettoolbarrepository';
 import WidgetToolbarRepository from '@ckeditor/ckeditor5-widget/src/widgettoolbarrepository';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import ImageToolbar from '@ckeditor/ckeditor5-image/src/imagetoolbar';
+import Image from '@ckeditor/ckeditor5-image/src/image';
+import ImageStyle from '@ckeditor/ckeditor5-image/src/imagestyle';
 
 
 describe( 'TableToolbar', () => {
 describe( 'TableToolbar', () => {
 	testUtils.createSinonSandbox();
 	testUtils.createSinonSandbox();
@@ -29,7 +32,10 @@ describe( 'TableToolbar', () => {
 
 
 			return ClassicTestEditor
 			return ClassicTestEditor
 				.create( editorElement, {
 				.create( editorElement, {
-					plugins: [ Paragraph, Table, TableToolbar, FakeButton ],
+					plugins: [ Paragraph, Image, ImageStyle, ImageToolbar, Table, TableToolbar, FakeButton ],
+					image: {
+						toolbar: [ 'imageStyle:full', 'imageStyle:side' ]
+					},
 					table: {
 					table: {
 						contentToolbar: [ 'fake_button' ]
 						contentToolbar: [ 'fake_button' ]
 					}
 					}
@@ -154,6 +160,36 @@ describe( 'TableToolbar', () => {
 				expect( balloon.visibleView ).to.equal( toolbar );
 				expect( balloon.visibleView ).to.equal( toolbar );
 			} );
 			} );
 
 
+			it( 'should not show the toolbar on ui#update when the image inside table is selected', () => {
+				setData(
+					model,
+					'<paragraph>[foo]</paragraph>' +
+					'<table><tableRow><tableCell><paragraph>foo</paragraph><image src=""></image></tableCell></tableRow></table>'
+				);
+
+				expect( balloon.visibleView ).to.be.null;
+
+				const imageToolbar = widgetToolbarRepository._toolbars.get( 'image' ).view;
+
+				model.change( writer => {
+					// Select the <tableCell><paragraph></paragraph>[<image></image>]</tableCell>
+					const nodeByPath = doc.getRoot().getNodeByPath( [ 1, 0, 0, 1 ] );
+
+					writer.setSelection( nodeByPath, 'on' );
+				} );
+
+				expect( balloon.visibleView ).to.equal( imageToolbar );
+
+				model.change( writer => {
+					// Select the <tableCell><paragraph>[]</paragraph><image></image></tableCell>
+					writer.setSelection(
+						writer.createPositionAt( doc.getRoot().getNodeByPath( [ 1, 0, 0, 0 ] ), 0 )
+					);
+				} );
+
+				expect( balloon.visibleView ).to.equal( toolbar );
+			} );
+
 			it( 'should not engage when the toolbar is in the balloon yet invisible', () => {
 			it( 'should not engage when the toolbar is in the balloon yet invisible', () => {
 				setData( model, '<table><tableRow><tableCell><paragraph>x[y]z</paragraph></tableCell></tableRow></table>' );
 				setData( model, '<table><tableRow><tableCell><paragraph>x[y]z</paragraph></tableCell></tableRow></table>' );