Browse Source

Renamed the command the UI component 'insertMedia'->'mediaEmbed'.

Aleksander Nowodzinski 7 years ago
parent
commit
d6adef3716

+ 1 - 1
packages/ckeditor5-media-embed/docs/_snippets/features/media-embed.js

@@ -12,7 +12,7 @@ ClassicEditor
 		cloudServices: CS_CONFIG,
 		toolbar: {
 			items: [
-				'insertMedia', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo'
+				'mediaEmbed', '|', 'heading', '|', 'bold', 'italic', '|', 'undo', 'redo'
 			],
 			viewportTopOffset: 60
 		},

+ 4 - 4
packages/ckeditor5-media-embed/docs/features/media-embed.md

@@ -34,7 +34,7 @@ import MediaEmbed from '@ckeditor/ckeditor5-media-embed/src/table';
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [ MediaEmbed, ... ],
-		toolbar: [ 'insertMedia', ... ]
+		toolbar: [ 'mediaEmbed', ... ]
 		mediaEmbed: {
 			...
 		}
@@ -72,13 +72,13 @@ To satisfy most of the use–cases, the feature can be configured using the {@li
 ## Common API
 
 The {@link module:media-embed/mediaembed~MediaEmbed} plugin registers:
-* the `'insertMedia'` UI button component,
-* the `'insertMedia'` command implemented by {@link module:media-embed/insertmediacommand~InsertMediaCommand}.
+* the `'mediaEmbed'` UI button component,
+* the `'mediaEmbed'` command implemented by {@link module:media-embed/insertmediacommand~InsertMediaCommand}.
 
 	You can insert a new media or update the selected media URL by executing the following code:
 
 	```js
-	editor.execute( 'insertMedia', { url: 'http://url.to.the/media' } );
+	editor.execute( 'mediaEmbed', { url: 'http://url.to.the/media' } );
 	```
 
 ## Contribute

+ 2 - 2
packages/ckeditor5-media-embed/src/insertmediacommand.js

@@ -14,11 +14,11 @@ import { getSelectedMediaElement } from './utils';
 /**
  * The insert media command.
  *
- * The command is registered by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} as `'insertMedia'`.
+ * The command is registered by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} as `'mediaEmbed'`.
  *
  * To insert a media at the current selection, execute the command and specify the URL:
  *
- *		editor.execute( 'insertMedia', 'http://url.to.the/media' );
+ *		editor.execute( 'mediaEmbed', 'http://url.to.the/media' );
  *
  * @extends module:core/command~Command
  */

+ 1 - 1
packages/ckeditor5-media-embed/src/mediaembedediting.js

@@ -120,7 +120,7 @@ export default class MediaEmbedEditing extends Plugin {
 		const semanticDataOutput = editor.config.get( 'mediaEmbed.semanticDataOutput' );
 		const mediaRegistry = this.mediaRegistry;
 
-		editor.commands.add( 'insertMedia', new InsertMediaCommand( editor ) );
+		editor.commands.add( 'mediaEmbed', new InsertMediaCommand( editor ) );
 
 		// Configure the schema.
 		schema.register( 'media', {

+ 3 - 3
packages/ckeditor5-media-embed/src/mediaembedui.js

@@ -31,11 +31,11 @@ export default class MediaEmbedUI extends Plugin {
 	 */
 	init() {
 		const editor = this.editor;
-		const command = editor.commands.get( 'insertMedia' );
+		const command = editor.commands.get( 'mediaEmbed' );
 		const mediaRegistry = editor.plugins.get( MediaEmbedEditing ).mediaRegistry;
 
 		// Setup `imageUpload` button.
-		editor.ui.componentFactory.add( 'insertMedia', locale => {
+		editor.ui.componentFactory.add( 'mediaEmbed', locale => {
 			const form = new MediaFormView( getFormValidators( editor.t, mediaRegistry ), locale );
 			const dropdown = createDropdown( locale );
 
@@ -76,7 +76,7 @@ export default class MediaEmbedUI extends Plugin {
 
 		dropdown.on( 'submit', () => {
 			if ( form.isValid() ) {
-				editor.execute( 'insertMedia', form.url );
+				editor.execute( 'mediaEmbed', form.url );
 				closeUI();
 			}
 		} );

+ 1 - 1
packages/ckeditor5-media-embed/tests/manual/mediaembed.js

@@ -13,7 +13,7 @@ ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [ ArticlePluginSet, MediaEmbed ],
 		toolbar: [
-			'heading', '|', 'insertMedia', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link', 'undo', 'redo'
+			'heading', '|', 'mediaEmbed', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link', 'undo', 'redo'
 		]
 	} )
 	.then( editor => {

+ 1 - 1
packages/ckeditor5-media-embed/tests/manual/semanticmediaembed.js

@@ -13,7 +13,7 @@ ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [ ArticlePluginSet, MediaEmbed ],
 		toolbar: [
-			'heading', '|', 'insertMedia', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link', 'undo', 'redo'
+			'heading', '|', 'mediaEmbed', '|', 'bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'link', 'undo', 'redo'
 		],
 		mediaEmbed: {
 			semanticDataOutput: true

+ 6 - 6
packages/ckeditor5-media-embed/tests/mediaembedui.js

@@ -31,7 +31,7 @@ describe( 'MediaEmbedUI', () => {
 			} )
 			.then( newEditor => {
 				editor = newEditor;
-				dropdown = editor.ui.componentFactory.create( 'insertMedia' );
+				dropdown = editor.ui.componentFactory.create( 'mediaEmbed' );
 				button = dropdown.buttonView;
 				form = dropdown.panelView.children.get( 0 );
 			} );
@@ -49,7 +49,7 @@ describe( 'MediaEmbedUI', () => {
 
 	describe( 'dropdown', () => {
 		it( 'should bind #isEnabled to the command', () => {
-			const command = editor.commands.get( 'insertMedia' );
+			const command = editor.commands.get( 'mediaEmbed' );
 
 			expect( dropdown.isEnabled ).to.be.true;
 
@@ -89,7 +89,7 @@ describe( 'MediaEmbedUI', () => {
 				} );
 
 				it( 'should update form\'s #url', () => {
-					const command = editor.commands.get( 'insertMedia' );
+					const command = editor.commands.get( 'mediaEmbed' );
 
 					button.fire( 'open' );
 					expect( form.url ).to.equal( '' );
@@ -126,7 +126,7 @@ describe( 'MediaEmbedUI', () => {
 
 			it( 'executes the command and closes the UI (if the form is valid)', () => {
 				const viewFocusSpy = sinon.spy( editor.editing.view, 'focus' );
-				const commandSpy = sinon.spy( editor.commands.get( 'insertMedia' ), 'execute' );
+				const commandSpy = sinon.spy( editor.commands.get( 'mediaEmbed' ), 'execute' );
 
 				// The form is invalid.
 				form.url = 'https://invalid/url';
@@ -186,7 +186,7 @@ describe( 'MediaEmbedUI', () => {
 		} );
 
 		it( 'binds urlInputView#isReadOnly to command#isEnabled', () => {
-			const command = editor.commands.get( 'insertMedia' );
+			const command = editor.commands.get( 'mediaEmbed' );
 
 			expect( form.urlInputView.isReadOnly ).to.be.false;
 
@@ -195,7 +195,7 @@ describe( 'MediaEmbedUI', () => {
 		} );
 
 		it( 'binds saveButtonView#isEnabled to command#isEnabled', () => {
-			const command = editor.commands.get( 'insertMedia' );
+			const command = editor.commands.get( 'mediaEmbed' );
 
 			expect( form.saveButtonView.isEnabled ).to.be.true;