diff --git a/src/view/placeholder.js b/src/view/placeholder.js index ec83640d4..b6cc478e3 100644 --- a/src/view/placeholder.js +++ b/src/view/placeholder.js @@ -151,6 +151,12 @@ export function needsPlaceholder( element ) { return false; } + // If the element is a Widget, always consider it a non-empty and thus not needing a placeholder. + // https://github.com/ckeditor/ckeditor5/issues/1684 + if ( element.getCustomProperty( 'widget' ) ) { + return false; + } + // The element is empty only as long as it contains nothing but uiElements. const isEmptyish = !Array.from( element.getChildren() ) .some( element => !element.is( 'uiElement' ) ); diff --git a/tests/view/placeholder.js b/tests/view/placeholder.js index 60a3d0730..43838765b 100644 --- a/tests/view/placeholder.js +++ b/tests/view/placeholder.js @@ -389,6 +389,20 @@ describe( 'placeholder', () => { expect( needsPlaceholder( element ) ).to.be.false; } ); + it( 'should return false if element is a widget', () => { + // Widget with ui-only elements inside (emptyish). + setData( view, '