Bladeren bron

Merge branch 'stable'

Piotrek Koszuliński 6 jaren geleden
bovenliggende
commit
da299829a1

+ 4 - 0
packages/ckeditor5-indent/README.md

@@ -12,6 +12,10 @@ CKEditor 5 block indentation feature
 
 This package implements block indentation support for CKEditor 5.
 
+## Demo
+
+Check out the [demo in the Block indentation feature](https://ckeditor.com/docs/ckeditor5/latest/features/indent.html#demo) guide.
+
 ## Documentation
 
 See the [`@ckeditor/ckeditor5-indent` package](https://ckeditor.com/docs/ckeditor5/latest/api/indent.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).

+ 5 - 15
packages/ckeditor5-indent/docs/_snippets/features/custom-indent-block-classes.html

@@ -10,30 +10,20 @@
 	.custom-block-indent-c {
 		margin-left: 30%;
 	}
-
-	.custom-block-indent-d {
-		margin-left: 40%;
-	}
-
-	.custom-block-indent-e {
-		margin-left: 50%;
-	}
 </style>
 
 <div id="snippet-indent-block-classes">
 	<h2>Block indentation using CSS classes</h2>
 
-	<p>If you want more semantics in your content, use CSS classes instead of fixed indentation units. You can then adjust
-		the levels in the styles sheets of your application whenever you want.&nbsp;</p>
+	<p>This is a normal paragraph with no indentation applied.</p>
 
 	<h3 class="custom-block-indent-a">This heading has the <code>.custom-block-indent-a</code> class</h3>
 
-	<p class="custom-block-indent-a">And this paragraph shares the same class, and that puts it at the same level.</p>
+	<p class="custom-block-indent-a">This paragraph shares the same class and that puts it at the same level.</p>
 
 	<h4 class="custom-block-indent-b">But this one has the <code>.custom-block-indent-b</code> class</h4>
 
-	<p class="custom-block-indent-b">Using classes instead of fixed units (<code>px</code> or <code>em</code>) has another
-		advantage. You retain control over what indentation levels are used in the documents. For instance, you can limit
-		indentation to 2 or 3 different levels and there is no way users can go beyond that (<code>.custom-block-indent-e</code> class level).
-		That should help you keep your content clean and predictable.</p>
+	<p class="custom-block-indent-b">This paragraph shares the same indentation class.</p>
+
+	<p class="custom-block-indent-c">This paragraph has the <code>.custom-block-indent-c</code> class. This is the maximum indentation level allowed in the configuration.</p>
 </div>

+ 1 - 3
packages/ckeditor5-indent/docs/_snippets/features/custom-indent-block-classes.js

@@ -31,9 +31,7 @@ ClassicEditor
 			classes: [
 				'custom-block-indent-a',
 				'custom-block-indent-b',
-				'custom-block-indent-c',
-				'custom-block-indent-d',
-				'custom-block-indent-e'
+				'custom-block-indent-c'
 			]
 		}
 	} )

+ 2 - 2
packages/ckeditor5-indent/docs/_snippets/features/indent.html

@@ -8,12 +8,12 @@
 
 	<h3>Indenting list items</h3>
 
-	<p>Block indentation buttons work with lists too! Check out the following list and play with different indentation levels:</p>
+	<p>Block indentation buttons work with lists, too! Check out the following list and play with different indentation levels:</p>
 
 	<ul>
 		<li>This is the shallowest list item.&nbsp;<ul>
 				<li>And this one is nested.</li>
-				<li>This one is nested too.<ul>
+				<li>This one is nested, too.<ul>
 						<li>And this one goes even deeper.</li>
 					</ul>
 				</li>

+ 1 - 1
packages/ckeditor5-indent/docs/api/indent.md

@@ -6,7 +6,7 @@ category: api-reference
 
 [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-indent.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-indent)
 
-This package implements the indent feature for CKEditor 5.
+This package implements the indentation feature for CKEditor 5.
 
 ## Demo
 

+ 22 - 26
packages/ckeditor5-indent/docs/features/indent.md

@@ -5,19 +5,21 @@ category: features
 
 {@snippet features/build-indent-source}
 
-## Demo
+The block indentation feature allows you to set indentation for text blocks such as paragraphs or headings and lists. It is implemented by three plugins: {@link module:indent/indent~Indent}, {@link module:indent/indentblock~IndentBlock} and {@link module:list/list~List}.
 
-The indentation feature allows to set indentation of text blocks like paragraphs or headings and lists.
+## Demo
 
 {@snippet features/indent}
 
 ## Configuring the block indentation feature
 
+This feature offers a few configuration options that can be used to adjust the text block indentation behavior.
+
 ### Using offset and unit
 
 By default, the block indentation feature increases or decreases the current indentation by the given offset, using the given unit.
 
-The editor used in the {@link features/indent#demo demo} section above uses the default configuration, which defines a `40px` indentation step.
+The rich-text editor from the {@link features/indent#demo demo} section above uses the default configuration, which defines a `40px` indentation step.
 
 You can change that value to, for example, `1em`:
 
@@ -41,7 +43,9 @@ ClassicEditor
 
 ### Using CSS classes
 
-Alternatively, the block indentation feature can be configured to set indentation by applying one of defined CSS classes:
+If you want more semantics in your content, use CSS classes instead of fixed indentation units. You can then adjust the levels in the style sheets of your application whenever you want. 
+
+Here is how you can configure the block indentation feature to set indentation by applying one of the defined CSS classes:
 
 ```js
 import Indent from '@ckeditor/ckeditor5-indent/src/indent';
@@ -57,9 +61,7 @@ ClassicEditor
 			classes: [
 				'custom-block-indent-a', // First step - smallest indentation.
 				'custom-block-indent-b',
-				'custom-block-indent-c',
-				'custom-block-indent-d',
-				'custom-block-indent-e'  // Last step - biggest indentation.
+				'custom-block-indent-c'  // Last step - biggest indentation.
 			]
 		}
 	} )
@@ -67,7 +69,9 @@ ClassicEditor
 	.catch( ... );
 ```
 
-The editor will restrict indentation levels to a set of provided classes. The biggest indentation is the class that has last index in the array.
+Using classes instead of fixed units (`px` or `em`) has another advantage &mdash; you retain control over what indentation levels are used in the documents. For instance, you can limit indentation to 2 or 3 different levels and there is no way the users can go beyond that. In the example above, the `.custom-block-indent-c` class level is the maximum allowed indentation value. This should help keep your content clean and predictable.
+
+In this configuration the WYSIWYG editor will restrict indentation levels to the set of provided classes. The class with the last index in the array has the biggest indentation.
 
 In the demo below the CSS classes are defined as follows:
 
@@ -83,14 +87,6 @@ In the demo below the CSS classes are defined as follows:
 .custom-block-indent-c {
 	margin-left: 30%;
 }
-
-.custom-block-indent-d {
-	margin-left: 40%;
-}
-
-.custom-block-indent-e {
-	margin-left: 50%;
-}
 ```
 
 <info-box>
@@ -101,16 +97,16 @@ In the demo below the CSS classes are defined as follows:
 
 ## Indenting lists
 
-The same set of buttons (`outdent`, `indent`), besides controlling block indentation, allows indenting list items (nesting them). This is completely transparent to the user.
+Besides controlling text block indentation, the same set of buttons (`outdent`, `indent`) allows for indenting list items (nesting them).
 
-From the code perspective, the buttons are implemented by the {@link module:indent/indent~Indent} plugin, but neither those buttons nor respective commands implement any functionality by default.
+This mechanism is completely transparent to the user. From the code perspective, the buttons are implemented by the {@link module:indent/indent~Indent} plugin, but neither these buttons nor the respective commands implement any functionality by default.
 
-The target behavior comes in two other plugins:
+The target behavior comes from two other plugins:
 
-* {@link module:indent/indentblock~IndentBlock} &mdash; The indent block feature controls the indentation of elements such as paragraphs and headings.
-* {@link module:list/list~List} &mdash; The list feature implements the indentation (nesting) of lists.
+* {@link module:indent/indentblock~IndentBlock} &ndash; The indent block feature controls the indentation of elements such as paragraphs and headings.
+* {@link module:list/list~List} &ndash; The list feature implements the indentation (nesting) of lists.
 
-This means, that if you want to allow indenting lists only, you can do that by load only the `Indent` and `List` plugins. If you want the full behavior, you need to load all 3 plugins.
+This means that if you want to allow indenting lists only, you can do that by loading only the `Indent` and `List` plugins. If you want the full behavior, you need to load all 3 plugins (`Indent`, `IndentBlock` and `List`).
 
 ## Installation
 
@@ -145,13 +141,13 @@ The {@link module:indent/indent~Indent} plugin registers the following component
 
 * The `'indent'` command.
 
-	Note, this command does not implement any behavior itself. It executes either `indentBlock` (described below) or `indentList`, depending on which of these commands is enabled.
+	This command does not implement any indentation behavior by itself. It executes either `indentBlock` (described below) or `indentList`, depending on which of these commands is enabled.
 
 	Read more in the [Indenting lists](#indenting-lists) section above.
 
 * The `'outdent'` command.
 
-	Note, this command does not implement any behavior itself. It executes either `outdentBlock` (described below) or `outdentList`, depending on which of these commands is enabled.
+	This command does not implement any indentation behavior by itself. It executes either `outdentBlock` (described below) or `outdentList`, depending on which of these commands is enabled.
 
 	Read more in the [Indenting lists](#indenting-lists) section above.
 
@@ -159,7 +155,7 @@ The {@link module:indent/indentblock~IndentBlock} plugin registers the following
 
 * The {@link module:indent/indentblockcommand~IndentBlockCommand `'indentBlock'`} command.
 
-	You can increase the indentation of the block in which the selection is set by:
+	You can increase the indentation of the text block that contains the selection by:
 
 	```js
 	editor.execute( 'indentBlock' );
@@ -167,7 +163,7 @@ The {@link module:indent/indentblock~IndentBlock} plugin registers the following
 
 * The {@link module:indent/indentblockcommand~IndentBlockCommand `'outdentBlock'`} command.
 
-	You can decrease the indentation of the block in which the selection is set by:
+	You can decrease the indentation of the text block that contains the selection by:
 
 	```js
 	editor.execute( 'outdentBlock' );

+ 6 - 6
packages/ckeditor5-indent/src/indent.js

@@ -15,22 +15,22 @@ import IndentUI from './indentui';
 /**
  * The indent feature.
  *
- * This plugin acts as a single entry point plugin for other features that implement indenting of elements like lists or paragraphs.
+ * This plugin acts as a single entry point plugin for other features that implement indentation of elements like lists or paragraphs.
  *
  * The compatible features are:
  *
  * * The {@link module:list/list~List} or {@link module:list/listediting~ListEditing} feature for list indentation.
  * * The {@link module:indent/indentblock~IndentBlock} feature for block indentation.
  *
- * This is a "glue" plugin which loads the following plugins:
+ * This is a "glue" plugin that loads the following plugins:
  *
- * * The {@link module:indent/indentediting~IndentEditing indent editing feature} and
+ * * The {@link module:indent/indentediting~IndentEditing indent editing feature}.
  * * The {@link module:indent/indentui~IndentUI indent UI feature}.
  *
- * The dependent plugins register the `'indent'` and `'outdent'` commands and it introduce the `'indent'` and `'outdent'` buttons
- * which allow to increase or decrease text indentation of supported elements.
+ * The dependent plugins register the `'indent'` and `'outdent'` commands and introduce the `'indent'` and `'outdent'` buttons
+ * that allow to increase or decrease text indentation of supported elements.
  *
- * **Note**: In order the commands and buttons to work at least one of compatible features is required.
+ * **Note**: In order for the commands and buttons to work, at least one of compatible features is required.
  *
  * @extends module:core/plugin~Plugin
  */

+ 11 - 11
packages/ckeditor5-indent/src/indentblock.js

@@ -18,8 +18,8 @@ import IndentUsingClasses from './indentcommandbehavior/indentusingclasses';
  *
  * It registers the `'indentBlock'` and `'outdentBlock'` commands.
  *
- * If the plugin {@link module:indent/indent~Indent} is defined it also attaches the `'indentBlock'` and `'outdentBlock'` commands to
- * `'indent'` and `'outdent'` commands.
+ * If the plugin {@link module:indent/indent~Indent} is defined, it also attaches the `'indentBlock'` and `'outdentBlock'` commands to
+ * the `'indent'` and `'outdent'` commands.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -215,7 +215,7 @@ function normalizeToMarginSideStyle( marginStyleValue, side ) {
 /**
  * The configuration of the block indentation feature.
  *
- * If no {@link module:indent/indentblock~IndentBlockConfig#classes} are set the block indentation feature will use
+ * If no {@link module:indent/indentblock~IndentBlockConfig#classes} are set, the block indentation feature will use
  * {@link module:indent/indentblock~IndentBlockConfig#offset} and {@link module:indent/indentblock~IndentBlockConfig#unit} to
  * create indentation steps.
  *
@@ -229,25 +229,25 @@ function normalizeToMarginSideStyle( marginStyleValue, side ) {
  *			.then( ... )
  *			.catch( ... );
  *
- * Alternatively the block indentation feature may set one of defined {@link module:indent/indentblock~IndentBlockConfig#classes} as
+ * Alternatively, the block indentation feature may set one of defined {@link module:indent/indentblock~IndentBlockConfig#classes} as
  * indentation steps:
  *
  *		ClassicEditor
  *			.create( editorElement, {
  * 				indentBlock: {
  *					classes: [
- *						'indent-a', // First step - smallest indentation.
+ *						'indent-a', // The first step - smallest indentation.
  *						'indent-b',
  *						'indent-c',
  *						'indent-d',
- *						'indent-e' // Last step - biggest indentation.
+ *						'indent-e' // The last step - biggest indentation.
  *					]
  * 				}
  *			} )
  *			.then( ... )
  *			.catch( ... );
  *
- * In the above example only 5 indentation steps will be available.
+ * In the example above only 5 indentation steps will be available.
  *
  * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
  *
@@ -255,7 +255,7 @@ function normalizeToMarginSideStyle( marginStyleValue, side ) {
  */
 
 /**
- * The size in indentation {@link module:indent/indentblock~IndentBlockConfig#unit units} of each indentation step.
+ * The size of indentation {@link module:indent/indentblock~IndentBlockConfig#unit units} for each indentation step.
  *
  * @default 40
  * @member {Number} module:indent/indentblock~IndentBlockConfig#offset
@@ -269,9 +269,9 @@ function normalizeToMarginSideStyle( marginStyleValue, side ) {
  */
 
 /**
- * An optional list of classes to use for indenting the contents. If not set or set to empty array, no classes will be used and instead
- * the {@link module:indent/indentblock~IndentBlockConfig#unit `indentBlock.unit`} and
- * {@link module:indent/indentblock~IndentBlockConfig#offset `indentBlock.offset`} properties will be used.
+ * An optional list of classes to use for indenting the editor content. If not set or set to an empty array, no classes will be used.
+ * The {@link module:indent/indentblock~IndentBlockConfig#unit `indentBlock.unit`} and
+ * {@link module:indent/indentblock~IndentBlockConfig#offset `indentBlock.offset`} properties will be used instead.
  *
  * @default undefined
  * @member {Array.<String>|undefined} module:indent/indentblock~IndentBlockConfig#classes

+ 9 - 9
packages/ckeditor5-indent/src/indentblockcommand.js

@@ -13,14 +13,14 @@ import first from '@ckeditor/ckeditor5-utils/src/first';
 /**
  * The indent block command.
  *
- * The command is registered by the {@link module:indent/indentblock~IndentBlock} as `'indentBlock'` - for indenting blocks and
- * `'outdentBlock'` - for outdenting blocks.
+ * The command is registered by the {@link module:indent/indentblock~IndentBlock} as `'indentBlock'` for indenting blocks and
+ * `'outdentBlock'` for outdenting blocks.
  *
- * To increase block indentation at current selection execute the command:
+ * To increase block indentation at the current selection, execute the command:
  *
  *		editor.execute( 'indentBlock' );
  *
- * To decrease block indentation at current selection execute the command:
+ * To decrease block indentation at the current selection, execute the command:
  *
  *		editor.execute( 'outdentBlock' );
  *
@@ -30,14 +30,14 @@ export default class IndentBlockCommand extends Command {
 	/**
 	 * Creates an instance of the command.
 	 *
-	 * @param {module:core/editor/editor~Editor} editor Editor instance.
+	 * @param {module:core/editor/editor~Editor} editor The editor instance.
 	 * @param {module:indent/indentblockcommand~IndentBehavior} indentBehavior
 	 */
 	constructor( editor, indentBehavior ) {
 		super( editor );
 
 		/**
-		 * Command's indentation behavior.
+		 * The command's indentation behavior.
 		 *
 		 * @type {module:indent/indentblockcommand~IndentBehavior}
 		 * @private
@@ -49,7 +49,7 @@ export default class IndentBlockCommand extends Command {
 	 * @inheritDoc
 	 */
 	refresh() {
-		// Check whether any of position's ancestor is a list item.
+		// Check whether any of the position's ancestors is a list item.
 		const editor = this.editor;
 		const model = editor.model;
 
@@ -106,10 +106,10 @@ function getBlocksToChange( model ) {
  */
 
 /**
- * Performs check if command should be enabled.
+ * Checks if the command should be enabled.
  *
  * @method #checkEnabled
- * @param {String} indentAttributeValue Current indent attribute value.
+ * @param {String} indentAttributeValue The current indent attribute value.
  * @returns {Boolean}
  */
 

+ 2 - 2
packages/ckeditor5-indent/src/indentcommandbehavior/indentusingclasses.js

@@ -18,7 +18,7 @@ export default class IndentUsingClasses {
 	 *
 	 * @param {Object} config
 	 * @param {String} config.direction The direction of indentation.
-	 * @param {Array.<String>} config.classes List of classes used for indentation.
+	 * @param {Array.<String>} config.classes A list of classes used for indentation.
 	 */
 	constructor( config ) {
 		/**
@@ -29,7 +29,7 @@ export default class IndentUsingClasses {
 		this.isForward = config.direction === 'forward';
 
 		/**
-		 * List of classes used for indentation.
+		 * A list of classes used for indentation.
 		 *
 		 * @type {Array.<String>}
 		 */

+ 3 - 3
packages/ckeditor5-indent/src/indentcommandbehavior/indentusingoffset.js

@@ -14,11 +14,11 @@
  */
 export default class IndentUsingOffset {
 	/**
-	 * Creates an instance of the behavior.
+	 * Creates an instance of the indentation behavior.
 	 *
 	 * @param {Object} config
 	 * @param {String} config.direction The direction of indentation.
-	 * @param {Number} config.offset Offset of next indentation step.
+	 * @param {Number} config.offset The offset of the next indentation step.
 	 * @param {String} config.unit Indentation unit.
 	 */
 	constructor( config ) {
@@ -30,7 +30,7 @@ export default class IndentUsingOffset {
 		this.isForward = config.direction === 'forward';
 
 		/**
-		 * Offset of next indentation step.
+		 * The offset of the next indentation step.
 		 *
 		 * @type {Number}
 		 */

+ 2 - 2
packages/ckeditor5-indent/src/indentediting.js

@@ -15,8 +15,8 @@ import MultiCommand from '@ckeditor/ckeditor5-core/src/multicommand';
  *
  * This plugin registers the `'indent'` and `'outdent'` commands.
  *
- * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in:
- * {@link module:indent/indent~Indent indent feature} API docs.
+ * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in the
+ * {@link module:indent/indent~Indent indent feature} API documentation.
  *
  * @extends module:core/plugin~Plugin
  */

+ 4 - 4
packages/ckeditor5-indent/src/indentui.js

@@ -13,12 +13,12 @@ import indentIcon from '../theme/icons/indent.svg';
 import outdentIcon from '../theme/icons/outdent.svg';
 
 /**
- * The indent feature.
+ * The indent UI feature.
  *
  * This plugin registers the `'indent'` and `'outdent'` buttons.
  *
- * **Note**: In order the commands to work at least one of compatible features is required. Read more in
- * {@link module:indent/indent~Indent indent feature} api docs.
+ * **Note**: In order for the commands to work, at least one of the compatible features is required. Read more in
+ * the {@link module:indent/indent~Indent indent feature} API documentation.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -46,7 +46,7 @@ export default class IndentUI extends Plugin {
 	}
 
 	/**
-	 * Defines an UI button.
+	 * Defines a UI button.
 	 *
 	 * @param {String} commandName
 	 * @param {String} label