diff --git a/package.json b/package.json index 10577bd9..a353f6fa 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@ckeditor/ckeditor5-editor-classic": "^11.0.0", "@ckeditor/ckeditor5-image": "^10.2.0", "@ckeditor/ckeditor5-list": "^11.0.1", + "@ckeditor/ckeditor5-media-embed": "^0.0.1", "@ckeditor/ckeditor5-paragraph": "^10.0.2", "@ckeditor/ckeditor5-undo": "^10.0.2", "@ckeditor/ckeditor5-utils": "^10.2.0", diff --git a/src/tableediting.js b/src/tableediting.js index 3c1c03b8..df0329e1 100644 --- a/src/tableediting.js +++ b/src/tableediting.js @@ -81,9 +81,13 @@ export default class TableEditing extends Plugin { } } ); - // Disallow image in table cell. + // Disallow image and media in table cell. schema.addChildCheck( ( context, childDefinition ) => { - if ( childDefinition.name == 'image' && Array.from( context.getNames() ).includes( 'table' ) ) { + if ( !Array.from( context.getNames() ).includes( 'table' ) ) { + return; + } + + if ( childDefinition.name == 'image' || childDefinition.name == 'media' ) { return false; } } ); diff --git a/tests/manual/tableblockcontent.md b/tests/manual/tableblockcontent.md index 50f4f2f3..ca992e4d 100644 --- a/tests/manual/tableblockcontent.md +++ b/tests/manual/tableblockcontent.md @@ -6,7 +6,6 @@ * List * Heading * Block Quote (with inner paragraph) - * Image 2. The third column consist blocks with text alignment. * Paragraph - should be rendered was `
` when alignment is set (apart from default) for single paragraph. diff --git a/tests/tableediting.js b/tests/tableediting.js index 736ea4db..fababcdc 100644 --- a/tests/tableediting.js +++ b/tests/tableediting.js @@ -20,6 +20,7 @@ import SplitCellCommand from '../src/commands/splitcellcommand'; import MergeCellCommand from '../src/commands/mergecellcommand'; import SetHeaderRowCommand from '../src/commands/setheaderrowcommand'; import SetHeaderColumnCommand from '../src/commands/setheadercolumncommand'; +import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting'; describe( 'TableEditing', () => { let editor, model; @@ -27,7 +28,7 @@ describe( 'TableEditing', () => { beforeEach( () => { return VirtualTestEditor .create( { - plugins: [ TableEditing, Paragraph, ImageEditing ] + plugins: [ TableEditing, Paragraph, ImageEditing, MediaEmbedEditing ] } ) .then( newEditor => { editor = newEditor; @@ -184,6 +185,15 @@ describe( 'TableEditing', () => { expect( getModelData( model, { withoutSelection: true } ) ) .to.equal( '