Procházet zdrojové kódy

Changed: Rename `insertImage` UI button to `uploadImage`.

Maciej Gołaszewski před 8 roky
rodič
revize
6aa186b68a

+ 3 - 3
packages/ckeditor5-upload/src/imageuploadui.js

@@ -14,7 +14,7 @@ import { isImageType, findOptimalInsertionPosition } from './utils';
 
 /**
  * Image upload button plugin.
- * Adds `insertImage` button to UI component factory.
+ * Adds `uploadImage` button to UI component factory.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -26,8 +26,8 @@ export default class ImageUploadUI extends Plugin {
 		const editor = this.editor;
 		const t = editor.t;
 
-		// Setup `insertImage` button.
-		editor.ui.componentFactory.add( 'insertImage', locale => {
+		// Setup `uploadImage` button.
+		editor.ui.componentFactory.add( 'uploadImage', locale => {
 			const view = new FileDialogButtonView( locale );
 			const command = editor.commands.get( 'imageUpload' );
 

+ 9 - 9
packages/ckeditor5-upload/tests/imageuploadui.js

@@ -55,14 +55,14 @@ describe( 'ImageUploadUI', () => {
 		return editor.destroy();
 	} );
 
-	it( 'should register insertImage button', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+	it( 'should register uploadImage button', () => {
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 
 		expect( button ).to.be.instanceOf( FileDialogButtonView );
 	} );
 
 	it( 'should be disabled while ImageUploadCommand is disabled', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const command = editor.commands.get( 'imageUpload' );
 
 		command.isEnabled = true;
@@ -76,7 +76,7 @@ describe( 'ImageUploadUI', () => {
 
 	// ckeditor5-upload/#77
 	it( 'should be properly bound with ImageUploadCommand', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const command = editor.commands.get( 'imageUpload' );
 		const spy = sinon.spy();
 
@@ -93,7 +93,7 @@ describe( 'ImageUploadUI', () => {
 
 	it( 'should execute imageUpload command', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock() ];
 
 		button.fire( 'done', files );
@@ -103,7 +103,7 @@ describe( 'ImageUploadUI', () => {
 	} );
 
 	it( 'should optimize the insertion position', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock() ];
 
 		setModelData( model, '<paragraph>f[]oo</paragraph>' );
@@ -119,7 +119,7 @@ describe( 'ImageUploadUI', () => {
 	} );
 
 	it( 'should correctly insert multiple files', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock(), createNativeFileMock() ];
 
 		setModelData( model, '<paragraph>foo[]</paragraph><paragraph>bar</paragraph>' );
@@ -139,7 +139,7 @@ describe( 'ImageUploadUI', () => {
 
 	it( 'should not execute imageUpload if the file is not an image', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const file = {
 			type: 'media/mp3',
 			size: 1024
@@ -151,7 +151,7 @@ describe( 'ImageUploadUI', () => {
 
 	it( 'should work even if the FileList does not support iterators', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = {
 			0: createNativeFileMock(),
 			length: 1

+ 1 - 1
packages/ckeditor5-upload/tests/manual/imageupload.js

@@ -30,7 +30,7 @@ ClassicEditor
 			Enter, Typing, Paragraph, Heading, Undo, Bold, Italic, Heading, List, Image, ImageToolbar, Clipboard,
 			ImageCaption, ImageStyle, ImageUpload
 		],
-		toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'insertImage' ],
+		toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'uploadImage' ],
 		image: {
 			toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
 		}