8
0
Просмотр исходного кода

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

Maciej Gołaszewski 8 лет назад
Родитель
Сommit
6aa186b68a

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

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

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

@@ -55,14 +55,14 @@ describe( 'ImageUploadUI', () => {
 		return editor.destroy();
 		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 );
 		expect( button ).to.be.instanceOf( FileDialogButtonView );
 	} );
 	} );
 
 
 	it( 'should be disabled while ImageUploadCommand is disabled', () => {
 	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' );
 		const command = editor.commands.get( 'imageUpload' );
 
 
 		command.isEnabled = true;
 		command.isEnabled = true;
@@ -76,7 +76,7 @@ describe( 'ImageUploadUI', () => {
 
 
 	// ckeditor5-upload/#77
 	// ckeditor5-upload/#77
 	it( 'should be properly bound with ImageUploadCommand', () => {
 	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 command = editor.commands.get( 'imageUpload' );
 		const spy = sinon.spy();
 		const spy = sinon.spy();
 
 
@@ -93,7 +93,7 @@ describe( 'ImageUploadUI', () => {
 
 
 	it( 'should execute imageUpload command', () => {
 	it( 'should execute imageUpload command', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock() ];
 		const files = [ createNativeFileMock() ];
 
 
 		button.fire( 'done', files );
 		button.fire( 'done', files );
@@ -103,7 +103,7 @@ describe( 'ImageUploadUI', () => {
 	} );
 	} );
 
 
 	it( 'should optimize the insertion position', () => {
 	it( 'should optimize the insertion position', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock() ];
 		const files = [ createNativeFileMock() ];
 
 
 		setModelData( model, '<paragraph>f[]oo</paragraph>' );
 		setModelData( model, '<paragraph>f[]oo</paragraph>' );
@@ -119,7 +119,7 @@ describe( 'ImageUploadUI', () => {
 	} );
 	} );
 
 
 	it( 'should correctly insert multiple files', () => {
 	it( 'should correctly insert multiple files', () => {
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = [ createNativeFileMock(), createNativeFileMock() ];
 		const files = [ createNativeFileMock(), createNativeFileMock() ];
 
 
 		setModelData( model, '<paragraph>foo[]</paragraph><paragraph>bar</paragraph>' );
 		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', () => {
 	it( 'should not execute imageUpload if the file is not an image', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const file = {
 		const file = {
 			type: 'media/mp3',
 			type: 'media/mp3',
 			size: 1024
 			size: 1024
@@ -151,7 +151,7 @@ describe( 'ImageUploadUI', () => {
 
 
 	it( 'should work even if the FileList does not support iterators', () => {
 	it( 'should work even if the FileList does not support iterators', () => {
 		const executeStub = sinon.stub( editor, 'execute' );
 		const executeStub = sinon.stub( editor, 'execute' );
-		const button = editor.ui.componentFactory.create( 'insertImage' );
+		const button = editor.ui.componentFactory.create( 'uploadImage' );
 		const files = {
 		const files = {
 			0: createNativeFileMock(),
 			0: createNativeFileMock(),
 			length: 1
 			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,
 			Enter, Typing, Paragraph, Heading, Undo, Bold, Italic, Heading, List, Image, ImageToolbar, Clipboard,
 			ImageCaption, ImageStyle, ImageUpload
 			ImageCaption, ImageStyle, ImageUpload
 		],
 		],
-		toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'insertImage' ],
+		toolbar: [ 'headings', 'undo', 'redo', 'bold', 'italic', 'bulletedList', 'numberedList', 'uploadImage' ],
 		image: {
 		image: {
 			toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
 			toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
 		}
 		}