Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Changed: Post-fixers should return early.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Jan 9, 2018
1 parent 09802bf commit 215a50d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/imagecaption/imagecaptionengine.js
Expand Up @@ -162,21 +162,17 @@ export default class ImageCaptionEngine extends Plugin {
const model = this.editor.model;
const changes = model.document.differ.getChanges();

let applied = false;

for ( const entry of changes ) {
if ( entry.type == 'insert' && entry.name == 'image' ) {
const item = entry.position.nodeAfter;

if ( !getCaptionFromImage( item ) ) {
writer.appendElement( 'caption', item );

applied = true;
return true;
}
}
}

return applied;
}
}

Expand Down

0 comments on commit 215a50d

Please sign in to comment.