Переглянути джерело

Docs: API docs for media embed corrected. [skip ci]

Anna Tomanek 7 роки тому
батько
коміт
d2e2f3eeea

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

@@ -46,7 +46,7 @@ export default class AutoMediaEmbed extends Plugin {
 		super( editor );
 
 		/**
-		 * A paste–to–embed `setTimeout` id. Stored as a property to allow
+		 * The paste–to–embed `setTimeout` ID. Stored as a property to allow
 		 * cleaning of the timeout.
 		 *
 		 * @private
@@ -55,7 +55,7 @@ export default class AutoMediaEmbed extends Plugin {
 		this._timeoutId = null;
 
 		/**
-		 * A position where the `<media>` element will be inserted after the timeout,
+		 * The position where the `<media>` element will be inserted after the timeout,
 		 * determined each time the new content is pasted into the document.
 		 *
 		 * @private
@@ -103,7 +103,7 @@ export default class AutoMediaEmbed extends Plugin {
 	}
 
 	/**
-	 * Analyzes the part of the document between provided positions in search for a URL representing a media.
+	 * Analyzes the part of the document between provided positions in search for a URL representing media.
 	 * When the URL is found, it is automatically converted into media.
 	 *
 	 * @protected

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

@@ -13,13 +13,13 @@ import ViewPosition from '@ckeditor/ckeditor5-engine/src/view/position';
 /**
  * Returns a function that converts the model "url" attribute to the view representation.
  *
- * Depending on the configuration the view representation can be "sementaic" (for data pipeline):
+ * Depending on the configuration, the view representation can be "semantic" (for the data pipeline):
  *
  *		<figure class="media">
  *			<oembed url="foo"></div>
  *		</figure>
  *
- * or "non-semantic" (for editing view pipeline):
+ * or "non-semantic" (for the editing view pipeline):
  *
  *		<figure class="media">
  *			<div data-oembed-url="foo">[ non-semantic media preview for "foo" ]</div>
@@ -31,7 +31,7 @@ import ViewPosition from '@ckeditor/ckeditor5-engine/src/view/position';
  * @param {module:media-embed/mediaregistry~MediaRegistry} registry The registry providing
  * the media and their content.
  * @param {Object} options
- * @param {String} [options.renderMediaPreview] When `true`, the converter will create view in the non-semantic form.
+ * @param {String} [options.renderMediaPreview] When `true`, the converter will create the view in the non-semantic form.
  * @param {String} [options.renderForEditingView] When `true`, the converter will create a view specific for the
  * editing pipeline (e.g. including CSS classes, content placeholders).
  * @returns {Function}

+ 18 - 18
packages/ckeditor5-media-embed/src/mediaembed.js

@@ -20,9 +20,9 @@ import Widget from '@ckeditor/ckeditor5-widget/src/widget';
  *
  * This is a "glue" plugin which loads the following plugins:
  *
- * * {@link module:media-embed/mediaembedediting~MediaEmbedEditing media embed editing feature},
- * * {@link module:media-embed/mediaembedui~MediaEmbedUI media embed UI feature} and
- * * {@link module:media-embed/automediaembed~AutoMediaEmbed auto-media embed feature}.
+ * * The {@link module:media-embed/mediaembedediting~MediaEmbedEditing media embed editing feature},
+ * * The {@link module:media-embed/mediaembedui~MediaEmbedUI media embed UI feature} and
+ * * The {@link module:media-embed/automediaembed~AutoMediaEmbed auto-media embed feature}.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -76,7 +76,7 @@ export default class MediaEmbed extends Plugin {
  *			url: /^.+/
  *		}
  *
- * To implement a responsive media, you can use the following HTML structure:
+ * To implement responsive media, you can use the following HTML structure:
  *
  *		{
  *			...
@@ -92,14 +92,14 @@ export default class MediaEmbed extends Plugin {
  * @property {String} name The name of the provider. Used e.g. when
  * {@link module:media-embed/mediaembed~MediaEmbedConfig#removeProviders removing providers}.
  * @property {RegExp|Array.<RegExp>} url The `RegExp` object (or array of objects) defining the URL of the media.
- * If any URL matches the `RegExp`, it becomes the media in editor model, as defined by the provider. The result
+ * If any URL matches the `RegExp`, it becomes the media in the editor model, as defined by the provider. The result
  * of matching (output of `String.prototype.match()`) is passed to the `html` rendering function of the media.
  *
- * **Note:** You do not need to include the protocol (`http://`, `https://`) and `www` subdomain in your `RegExps`,
+ * **Note:** You do not need to include the protocol (`http://`, `https://`) and `www` subdomain in your `RegExps`,
  * they are stripped from the URLs before matching anyway.
- * @property {Function} [html] (optional) Rendering function of the media. The function receives the entire matching
+ * @property {Function} [html] (optional) The rendering function of the media. The function receives the entire matching
  * array from the corresponding `url` `RegExp` as an argument, allowing rendering a dedicated
- * preview of a media identified by a certain id or a hash. When not defined, the media embed feature
+ * preview of the media identified by a certain ID or a hash. When not defined, the media embed feature
  * will use a generic media representation in the view and output data.
  * Note that when
  * {@link module:media-embed/mediaembed~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`}
@@ -134,14 +134,14 @@ export default class MediaEmbed extends Plugin {
 /**
  * The default media providers supported by the editor.
  *
- * Names of providers with rendering functions (previews):
+ * The names of providers with rendering functions (previews):
  *
  * * "dailymotion",
  * * "spotify",
  * * "youtube",
  * * "vimeo"
  *
- * Names of providers without rendering functions:
+ * The names of providers without rendering functions:
  *
  * * "instagram",
  * * "twitter",
@@ -155,15 +155,15 @@ export default class MediaEmbed extends Plugin {
  * **Note**: The default media provider configuration may not support all possible media URLs,
  * only the most common are included.
  *
- * **Note**: Media without are always represented in the data using the "semantic" markup. See
+ * Media without rendering functions are always represented in the data using the "semantic" markup. See
  * {@link module:media-embed/mediaembed~MediaEmbedConfig#previewsInData `config.mediaEmbed.previewsInData`} to
  * learn more about possible data outputs.
  *
- * **Note:**: The priority of media providers corresponds to the order of configuration. The first provider
- * to match the URL is always used, even if there are other providers which support a particular URL.
- * The URL is never matched against remaining providers.
+ * The priority of media providers corresponds to the order of configuration. The first provider
+ * to match the URL is always used, even if there are other providers that support a particular URL.
+ * The URL is never matched against the remaining providers.
  *
- * To discard **all** default media providers, simply override this config with your own
+ * To discard **all** default media providers, simply override this configuration with your own
  * {@link module:media-embed/mediaembed~MediaEmbedProvider definitions}:
  *
  *		ClassicEditor
@@ -183,7 +183,7 @@ export default class MediaEmbed extends Plugin {
  *			.then( ... )
  *			.catch( ... );
  *
- * You can take inspirtation from the default configuration of this feature which you can find in:
+ * You can take inspiration from the default configuration of this feature which you can find in:
  * https://github.com/ckeditor/ckeditor5-media-embed/blob/master/src/mediaembedediting.js
  *
  * To **extend** the list of default providers, use
@@ -222,7 +222,7 @@ export default class MediaEmbed extends Plugin {
  */
 
 /**
- * The list of media providers which should not be used despite being available in
+ * The list of media providers that should not be used despite being available in
  * {@link module:media-embed/mediaembed~MediaEmbedConfig#providers `config.mediaEmbed.providers`} and
  * {@link module:media-embed/mediaembed~MediaEmbedConfig#extraProviders `config.mediaEmbed.extraProviders`}
  *
@@ -252,7 +252,7 @@ export default class MediaEmbed extends Plugin {
  *			</div>
  *		</figure>
  *
- * **Note:** Preview–less media are always represented in the data using the "semantic" markup
+ * **Note:** Media without preview are always represented in the data using the "semantic" markup
  * regardless of the value of the `previewsInData`. Learn more about different kinds of media
  * in the {@link module:media-embed/mediaembed~MediaEmbedConfig#providers `config.mediaEmbed.providers`}
  * configuration description.

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

@@ -16,7 +16,7 @@ import { getSelectedMediaElement } from './utils';
  *
  * 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:
+ * To insert media at the current selection, execute the command and specify the URL:
  *
  *		editor.execute( 'mediaEmbed', 'http://url.to.the/media' );
  *
@@ -46,7 +46,7 @@ export default class MediaEmbedCommand extends Command {
 	/**
 	 * Executes the command, which either:
 	 *
-	 * * updates the URL of a selected media,
+	 * * updates the URL of the selected media,
 	 * * inserts the new media into the editor and puts the selection around it.
 	 *
 	 * @fires execute

+ 16 - 16
packages/ckeditor5-media-embed/src/mediaregistry.js

@@ -16,7 +16,7 @@ import Template from '@ckeditor/ckeditor5-ui/src/template';
 const mediaPlaceholderIconViewBox = '0 0 64 42';
 
 /**
- * A bridge between the raw media content provider definitions and editor view content.
+ * A bridge between the raw media content provider definitions and the editor view content.
  *
  * It helps translating media URLs to corresponding {@link module:engine/view/element~Element view elements}.
  *
@@ -40,7 +40,7 @@ export default class MediaRegistry {
 
 				if ( !name ) {
 					/**
-					 * One of the providers (or extraProviders) specified in the mediaEmbed configuration
+					 * One of the providers (or extra providers) specified in the media embed configuration
 					 * has no name and will not be used by the editor. In order to get this media
 					 * provider working, double check your editor configuration.
 					 *
@@ -74,7 +74,7 @@ export default class MediaRegistry {
 	/**
 	 * Checks whether the passed URL is representing a certain media type allowed in the editor.
 	 *
-	 * @param {String} url The url to be checked
+	 * @param {String} url The URL to be checked
 	 * @returns {Boolean}
 	 */
 	hasMedia( url ) {
@@ -88,7 +88,7 @@ export default class MediaRegistry {
 	 * **Note:** If no URL is specified, an empty view element is returned.
 	 *
 	 * @param {module:engine/view/downcastwriter~DowncastWriter} writer The view writer used to produce a view element.
-	 * @param {String} url The url to be translated into a view element.
+	 * @param {String} url The URL to be translated into a view element.
 	 * @param {Object} options
 	 * @param {String} [options.renderMediaPreview]
 	 * @param {String} [options.renderForEditingView]
@@ -102,8 +102,8 @@ export default class MediaRegistry {
 	 * Returns a `Media` instance for the given URL.
 	 *
 	 * @protected
-	 * @param {String} url The url of the media.
-	 * @returns {module:media-embed/mediaregistry~Media|null} The `Media` instance or `null` when there's none.
+	 * @param {String} url The URL of the media.
+	 * @returns {module:media-embed/mediaregistry~Media|null} The `Media` instance or `null` when there is none.
 	 */
 	_getMedia( url ) {
 		if ( !url ) {
@@ -136,12 +136,12 @@ export default class MediaRegistry {
 	 * Tries to match `url` to `pattern`.
 	 *
 	 * @private
-	 * @param {String} url The url of the media.
-	 * @param {RegExp} pattern The pattern that should accept the media url.
+	 * @param {String} url The URL of the media.
+	 * @param {RegExp} pattern The pattern that should accept the media URL.
 	 * @returns {Array|null}
 	 */
 	_getUrlMatches( url, pattern ) {
-		// 1. Try to match without stripping the protocol and "www" sub-domain.
+		// 1. Try to match without stripping the protocol and "www" subdomain.
 		let match = url.match( pattern );
 
 		if ( match ) {
@@ -156,7 +156,7 @@ export default class MediaRegistry {
 			return match;
 		}
 
-		// 3. Try to match after stripping the "www" sub-domain.
+		// 3. Try to match after stripping the "www" subdomain.
 		rawUrl = rawUrl.replace( /^www\./, '' );
 		match = rawUrl.match( pattern );
 
@@ -169,9 +169,9 @@ export default class MediaRegistry {
 }
 
 /**
- * Represents a media defined by the provider configuration.
+ * Represents media defined by the provider configuration.
  *
- * It can be rendered to the {@link module:engine/view/element~Element view element} and used in editing or data pipeline.
+ * It can be rendered to the {@link module:engine/view/element~Element view element} and used in the editing or data pipeline.
  *
  * @private
  */
@@ -208,7 +208,7 @@ class Media {
 	}
 
 	/**
-	 * Returns view element representation of the media.
+	 * Returns the view element representation of the media.
 	 *
 	 * @param {module:engine/view/downcastwriter~DowncastWriter} writer The view writer used to produce a view element.
 	 * @param {Object} options
@@ -269,7 +269,7 @@ class Media {
 	}
 
 	/**
-	 * Returns the placeholder HTML when media has no content preview.
+	 * Returns the placeholder HTML when the media has no content preview.
 	 *
 	 * @returns {String}
 	 */
@@ -319,9 +319,9 @@ class Media {
 	}
 
 	/**
-	 * Returns full url to specified media.
+	 * Returns the full URL to the specified media.
 	 *
-	 * @param {String} url The url of the media.
+	 * @param {String} url The URL of the media.
 	 * @returns {String|null}
 	 */
 	_getValidUrl( url ) {

+ 8 - 8
packages/ckeditor5-media-embed/src/ui/mediaformview.js

@@ -79,7 +79,7 @@ export default class MediaFormView extends View {
 		this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'ck-button-cancel', 'cancel' );
 
 		/**
-		 * A collection of views which can be focused in the form.
+		 * A collection of views that can be focused in the form.
 		 *
 		 * @readonly
 		 * @protected
@@ -108,7 +108,7 @@ export default class MediaFormView extends View {
 		} );
 
 		/**
-		 * An array of the form validators used by {@link #isValid}.
+		 * An array of form validators used by {@link #isValid}.
 		 *
 		 * @readonly
 		 * @protected
@@ -191,8 +191,8 @@ export default class MediaFormView extends View {
 	/**
 	 * The native DOM `value` of the {@link #urlInputView} element.
 	 *
-	 * **Note**: Do not confuse with the {@link module:ui/inputtext/inputtextview~InputTextView#value}
-	 * which works one way only and may not represent the actual state of the component in DOM.
+	 * **Note**: Do not confuse it with the {@link module:ui/inputtext/inputtextview~InputTextView#value}
+	 * which works one way only and may not represent the actual state of the component in the DOM.
 	 *
 	 * @type {Number}
 	 */
@@ -203,8 +203,8 @@ export default class MediaFormView extends View {
 	/**
 	 * Sets the native DOM `value` of the {@link #urlInputView} element.
 	 *
-	 * **Note**: Do not confuse with the {@link module:ui/inputtext/inputtextview~InputTextView#value}
-	 * which works one way only and may not represent the actual state of the component in DOM.
+	 * **Note**: Do not confuse it with the {@link module:ui/inputtext/inputtextview~InputTextView#value}
+	 * which works one way only and may not represent the actual state of the component in the DOM.
 	 *
 	 * @param {String} url
 	 */
@@ -223,7 +223,7 @@ export default class MediaFormView extends View {
 		for ( const validator of this._validators ) {
 			const errorText = validator( this );
 
-			// One error per-field is enough.
+			// One error per field is enough.
 			if ( errorText ) {
 				// Apply updated error.
 				this.urlInputView.errorText = errorText;
@@ -264,7 +264,7 @@ export default class MediaFormView extends View {
 	 *
 	 * @private
 	 * @param {String} label The button label.
-	 * @param {String} icon The button's icon.
+	 * @param {String} icon The button icon.
 	 * @param {String} className The additional button CSS class name.
 	 * @param {String} [eventName] An event name that the `ButtonView#execute` event will be delegated to.
 	 * @returns {module:ui/button/buttonview~ButtonView} The button view instance.

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

@@ -45,7 +45,7 @@ export function isMediaWidget( viewElement ) {
  *			<oembed url="foo"></div>
  *		</figure>
  *
- * or "non-semantic" (for editing view pipeline):
+ * or "non-semantic" (for the editing view pipeline):
  *
  *		<figure class="media">
  *			<div data-oembed-url="foo">[ non-semantic media preview for "foo" ]</div>
@@ -74,7 +74,7 @@ export function createMediaFigureElement( writer, registry, url, options ) {
 }
 
 /**
- * Returns a selected media element in model, if any.
+ * Returns a selected media element in the model, if any.
  *
  * @param {module:engine/model/selection~Selection} selection
  * @returns {module:engine/model/element~Element|null}