瀏覽代碼

Rename `options.sources` to `options.source` in `ImageInsertCommand`.

Maciej Gołaszewski 7 年之前
父節點
當前提交
d49e602f4b

+ 2 - 2
packages/ckeditor5-image/src/image/imageinsertcommand.js

@@ -28,13 +28,13 @@ export default class ImageInsertCommand extends Command {
 	 *
 	 * @fires execute
 	 * @param {Object} options Options for the executed command.
-	 * @param {String|Array.<String>} options.sources The image source or an array of image sources to insert.
+	 * @param {String|Array.<String>} options.source The image source or an array of image sources to insert.
 	 */
 	execute( options ) {
 		const model = this.editor.model;
 
 		model.change( writer => {
-			const sources = Array.isArray( options.sources ) ? options.sources : [ options.sources ];
+			const sources = Array.isArray( options.source ) ? options.source : [ options.source ];
 
 			for ( const src of sources ) {
 				insertImage( writer, model, { src } );

+ 3 - 3
packages/ckeditor5-image/tests/image/imageinsertcommand.js

@@ -121,7 +121,7 @@ describe( 'ImageInsertCommand', () => {
 
 			setModelData( model, '<paragraph>f[o]o</paragraph>' );
 
-			command.execute( { sources: imgSrc } );
+			command.execute( { source: imgSrc } );
 
 			expect( getModelData( model ) ).to.equal( `[<image src="${ imgSrc }"></image>]<paragraph>foo</paragraph>` );
 		} );
@@ -132,7 +132,7 @@ describe( 'ImageInsertCommand', () => {
 
 			setModelData( model, '<paragraph>f[o]o</paragraph>' );
 
-			command.execute( { sources: [ imgSrc1, imgSrc2 ] } );
+			command.execute( { source: [ imgSrc1, imgSrc2 ] } );
 
 			expect( getModelData( model ) )
 				.to.equal( `<image src="${ imgSrc1 }"></image>[<image src="${ imgSrc2 }"></image>]<paragraph>foo</paragraph>` );
@@ -151,7 +151,7 @@ describe( 'ImageInsertCommand', () => {
 
 			setModelData( model, '<other>[]</other>' );
 
-			command.execute( { sources: imgSrc } );
+			command.execute( { source: imgSrc } );
 
 			expect( getModelData( model ) ).to.equal( '<other>[]</other>' );
 		} );