diff --git a/src/imagecaption/imagecaptionediting.js b/src/imagecaption/imagecaptionediting.js index 7d616a08..c1968971 100644 --- a/src/imagecaption/imagecaptionediting.js +++ b/src/imagecaption/imagecaptionediting.js @@ -190,16 +190,9 @@ export default class ImageCaptionEditing extends Plugin { // Check elements with children for nested images. if ( !item.is( 'image' ) && item.childCount ) { - // Use the walker to find all nested images despite of their nest level. - const walker = model.createRangeOn( item ).getWalker(); - - for ( const walkerValue of walker ) { - if ( walkerValue.type === 'elementStart' ) { - const walkerItem = walkerValue.item; - - if ( walkerItem.is( 'image' ) && !getCaptionFromImage( walkerItem ) ) { - imagesWithoutCaption.push( walkerItem ); - } + for ( const nestedItem of model.createRangeIn( item ).getItems() ) { + if ( nestedItem.is( 'image' ) && !getCaptionFromImage( nestedItem ) ) { + imagesWithoutCaption.push( nestedItem ); } } }