Selaa lähdekoodia

Docs: API docs reviewed.

Anna Tomanek 8 vuotta sitten
vanhempi
commit
e104948f23

+ 16 - 15
packages/ckeditor5-autoformat/src/autoformat.js

@@ -16,14 +16,14 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  *
  * ## Bulleted list
  *
- * You can create a bulleted list by staring a line with:
+ * You can create a bulleted list by starting a line with:
  *
  * * `* `
  * * `- `
  *
  * ## Numbered list
  *
- * You can create a numbered list by staring a line with:
+ * You can create a numbered list by starting a line with:
  *
  * * `1. `
  * * `1) `
@@ -32,18 +32,18 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
  *
  * You can create a heading by starting a line with:
  *
- * `# ` – will create Heading 1,
- * `## ` – will create Heading 2,
- * `### ` – will create Heading 3.
+ * * `# ` – will create Heading 1,
+ * * `## ` – will create Heading 2,
+ * * `### ` – will create Heading 3.
  *
  * ## Bold and italic
  *
  * You can apply bold or italic to a text by typing Markdown formatting:
  *
- * * `**foo bar**` or `__foo bar__` – will bold the text,
- * * `*foo bar*` or `_foo bar_` – will italicize the text,
+ * * `**foo bar**` or `__foo bar__` – will bold the text.
+ * * `*foo bar*` or `_foo bar_` – will italicize the text.
  *
- * NOTE: Remember to add proper features to the editor configuration. Autoformatting will be enabled only for those
+ * NOTE: Remember to add proper features to the editor configuration. Autoformatting will be enabled only for the
  * commands that are included in the actual configuration. For example: `bold` autoformatting will not work if there is no
  * `bold` command registered in the editor.
  *
@@ -71,8 +71,8 @@ export default class Autoformat extends Plugin {
 	 * Adds autoformatting related to the {@link module:list/list~List}.
 	 *
 	 * When typed:
-	 * - `* ` or `- ` - a paragraph will be changed to a bulleted list,
-	 * - `1. ` or `1) ` - a paragraph will be changed to a numbered list ("1" can be any digit or list of digits).
+	 * - `* ` or `- ` – A paragraph will be changed to a bulleted list.
+	 * - `1. ` or `1) ` – A paragraph will be changed to a numbered list ("1" can be any digit or a list of digits).
 	 *
 	 * @private
 	 */
@@ -95,10 +95,10 @@ export default class Autoformat extends Plugin {
 	 * {@link module:basic-styles/italic~Italic}.
 	 *
 	 * When typed:
-	 * - `**foobar**`: `**` characters are removed, and `foobar` is set to bold,
-	 * - `__foobar__`: `__` characters are removed, and `foobar` is set to bold,
-	 * - `*foobar*`: `*` characters are removed, and `foobar` is set to italic,
-	 * - `_foobar_`: `_` characters are removed, and `foobar` is set to italic.
+	 * - `**foobar**` – `**` characters are removed and `foobar` is set to bold.
+	 * - `__foobar__` – `__` characters are removed and `foobar` is set to bold.
+	 * - `*foobar*` – `*` characters are removed and `foobar` is set to italic.
+	 * - `_foobar_` – `_` characters are removed and `foobar` is set to italic.
 	 *
 	 * @private
 	 */
@@ -152,8 +152,9 @@ export default class Autoformat extends Plugin {
 
 	/**
 	 * Adds autoformatting related to {@link module:block-quote/blockquote~BlockQuote}.
+	 *
 	 * When typed:
-	 * * `> ` - a paragraph will be changed to a block quote.
+	 * * `> ` – A paragraph will be changed to a block quote.
 	 *
 	 * @private
 	 */

+ 13 - 13
packages/ckeditor5-autoformat/src/blockautoformatengine.js

@@ -11,11 +11,11 @@ import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 import TextProxy from '@ckeditor/ckeditor5-engine/src/model/textproxy';
 
 /**
- * The block autoformatting engine. Allows to format various block patterns. For example,
- * it can be configured to make a paragraph starting with "* " a list item.
+ * The block autoformatting engine. It allows to format various block patterns. For example,
+ * it can be configured to turn a paragraph starting with "* " into a list item.
  *
  * The autoformatting operation is integrated with the undo manager,
- * so the autoformatting step can be undone, if the user's intention wasn't to format the text.
+ * so the autoformatting step can be undone if the user's intention was not to format the text.
  *
  * See the constructors documentation to learn how to create custom inline autoformatters. You can also use
  * the {@link module:autoformat/autoformat~Autoformat} feature which enables a set of default autoformatters
@@ -23,17 +23,17 @@ import TextProxy from '@ckeditor/ckeditor5-engine/src/model/textproxy';
  */
 export default class BlockAutoformatEngine {
 	/**
-	 * Creates listener triggered on `change` event in document.
-	 * Calls callback when inserted text matches regular expression or command name
-	 * if provided instead of callback.
+	 * Creates a listener triggered on `change` event in the document.
+	 * Calls the callback when inserted text matches the regular expression or the command name
+	 * if provided instead of the callback.
 	 *
 	 * Examples of usage:
 	 *
-	 * To convert paragraph to heading1 when `- ` is typed, using just commmand name:
+	 * To convert a paragraph to heading 1 when `- ` is typed, using just the commmand name:
 	 *
 	 *		new BlockAutoformatEngine( editor, /^\- $/, 'heading1' );
 	 *
-	 * To convert paragraph to heading1 when `- ` is typed, using just callback:
+	 * To convert a paragraph to heading 1 when `- ` is typed, using just the callback:
 	 *
 	 *		new BlockAutoformatEngine( editor, /^\- $/, ( context ) => {
 	 *			const { batch, match } = context;
@@ -45,12 +45,12 @@ export default class BlockAutoformatEngine {
 	 *			} );
 	 * 		} );
 	 *
-	 * @param {module:core/editor/editor~Editor} editor Editor instance.
-	 * @param {RegExp} pattern Regular expression to exec on just inserted text.
-	 * @param {Function|String} callbackOrCommand Callback to execute or command to run when text is matched.
-	 * In case of providing callback it receives following parameters:
+	 * @param {module:core/editor/editor~Editor} editor The editor instance.
+	 * @param {RegExp} pattern The regular expression to execute on just inserted text.
+	 * @param {Function|String} callbackOrCommand The callback to execute or the command to run when the text is matched.
+	 * In case of providing the callback, it receives the following parameters:
 	 * * {module:engine/model/batch~Batch} batch Newly created batch for autoformat changes.
-	 * * {Object} match RegExp.exec() result of matching pattern to inserted text.
+	 * * {Object} match RegExp.exec() result of matching the pattern to inserted text.
 	 */
 	constructor( editor, pattern, callbackOrCommand ) {
 		let callback;

+ 18 - 18
packages/ckeditor5-autoformat/src/inlineautoformatengine.js

@@ -10,11 +10,11 @@
 import LiveRange from '@ckeditor/ckeditor5-engine/src/model/liverange';
 
 /**
- * The inline autoformatting engine. Allows to format various inline patterns. For example,
+ * The inline autoformatting engine. It allows to format various inline patterns. For example,
  * it can be configured to make "foo" bold when typed `**foo**` (the `**` markers will be removed).
  *
  * The autoformatting operation is integrated with the undo manager,
- * so the autoformatting step can be undone, if the user's intention wasn't to format the text.
+ * so the autoformatting step can be undone if the user's intention was not to format the text.
  *
  * See the constructors documentation to learn how to create custom inline autoformatters. You can also use
  * the {@link module:autoformat/autoformat~Autoformat} feature which enables a set of default autoformatters
@@ -22,38 +22,38 @@ import LiveRange from '@ckeditor/ckeditor5-engine/src/model/liverange';
  */
 export default class InlineAutoformatEngine {
 	/**
-	 * Enables autoformatting mechanism on a given {@link module:core/editor/editor~Editor}.
+	 * Enables autoformatting mechanism for a given {@link module:core/editor/editor~Editor}.
 	 *
-	 * It formats the matched text by applying given model attribute or by running the provided formatting callback.
-	 * Each time data model changes text from given node (from the beginning of the current node to the collapsed
+	 * It formats the matched text by applying the given model attribute or by running the provided formatting callback.
+	 * Each time the data model changes the text from a given node (from the beginning of the current node to the collapsed
 	 * selection location) will be tested.
 	 *
-	 * @param {module:core/editor/editor~Editor} editor Editor instance.
-	 * @param {Function|RegExp} testRegexpOrCallback RegExp or callback to execute on text.
-	 * Provided RegExp *must* have three capture groups. First and third capture groups
-	 * should match opening/closing delimiters. Second capture group should match text to format.
+	 * @param {module:core/editor/editor~Editor} editor The editor instance.
+	 * @param {Function|RegExp} testRegexpOrCallback The regular expression or callback to execute on text.
+	 * Provided regular expression *must* have three capture groups. The first and the third capture group
+	 * should match opening and closing delimiters. The second capture group should match the text to format.
 	 *
-	 *		// Matches `**bold text**` pattern.
+	 *		// Matches the `**bold text**` pattern.
 	 *		// There are three capturing groups:
-	 *		// - first to match starting `**` delimiter,
-	 *		// - second to match text to format,
-	 *		// - third to match ending `**` delimiter.
+	 *		// - The first to match the starting `**` delimiter.
+	 *		// - The second to match the text to format.
+	 *		// - The third to match the ending `**` delimiter.
 	 *		new InlineAutoformatEngine( editor, /(\*\*)([^\*]+?)(\*\*)$/g, 'bold' );
 	 *
-	 * When function is provided instead of RegExp, it will be executed with text to match as a parameter. Function
-	 * should return proper "ranges" to delete and format.
+	 * When a function is provided instead of the regular expression, it will be executed with the text to match as a parameter.
+	 * The function should return proper "ranges" to delete and format.
 	 *
 	 *		{
 	 *			remove: [
-	 *				[ 0, 1 ],	// Remove first letter from the given text.
-	 *				[ 5, 6 ]	// Remove 6th letter from the given text.
+	 *				[ 0, 1 ],	// Remove the first letter from the given text.
+	 *				[ 5, 6 ]	// Remove the 6th letter from the given text.
 	 *			],
 	 *			format: [
 	 *				[ 1, 5 ]	// Format all letters from 2nd to 5th.
 	 *			]
 	 *		}
 	 *
-	 * @param {Function|String} attributeOrCallback Name of attribute to apply on matching text or callback for manual
+	 * @param {Function|String} attributeOrCallback The name of attribute to apply on matching text or a callback for manual
 	 * formatting.
 	 *
 	 *		// Use attribute name: