Explorar el Código

Changed: Post-fixers should return early.

Szymon Cofalik hace 8 años
padre
commit
a4b2e5afb8

+ 1 - 5
packages/ckeditor5-image/src/imagecaption/imagecaptionengine.js

@@ -162,8 +162,6 @@ 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;
@@ -171,12 +169,10 @@ export default class ImageCaptionEngine extends Plugin {
 				if ( !getCaptionFromImage( item ) ) {
 					writer.appendElement( 'caption', item );
 
-					applied = true;
+					return true;
 				}
 			}
 		}
-
-		return applied;
 	}
 }