Przeglądaj źródła

Merge branch 'master' into t/1434

Oskar Wróbel 6 lat temu
rodzic
commit
838db51218

+ 1 - 1
packages/ckeditor5-list/README.md

@@ -9,7 +9,7 @@ CKEditor 5 list feature
 [![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-list/status.svg)](https://david-dm.org/ckeditor/ckeditor5-list)
 [![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-list/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-list?type=dev)
 
-This package implements bulleted and numbered list feature for CKEditor 5.
+This package implements bulleted, numbered and to-do list feature for CKEditor 5.
 
 ## Documentation
 

+ 4 - 4
packages/ckeditor5-list/docs/features/todo-lists.md

@@ -4,7 +4,7 @@ category: features
 
 # To-do lists
 
-The to-do list feature lets you create lists of interactive checkboxes with labels. They support all features of regular lists so you can nest to-do list together with bulleted and numbered lists in any combination.
+The to-do list feature lets you create a list of interactive checkboxes with labels. It supports all features of regular lists so you can nest a to-do list together with bulleted and numbered lists in any combination.
 
 ## Demo
 
@@ -12,7 +12,7 @@ The to-do list feature lets you create lists of interactive checkboxes with labe
 
 ## Keyboard support
 
-You can check/uncheck an item by using the <kbd>Ctrl</kbd> + <kbd>Space</kbd> (or <kbd>⌘</kbd> + <kbd>Space</kbd> if you are using macOS) shortcut when the selection is in that item.
+You can check and uncheck a list item by using the <kbd>Ctrl</kbd> + <kbd>Space</kbd> (or <kbd>⌘</kbd> + <kbd>Space</kbd> if you are using macOS) shortcut when the selection is in that item.
 
 ## Installation
 
@@ -42,7 +42,7 @@ ClassicEditor
 
 ## HTML structure
 
-When you call {@link module:core/editor/utils/dataapimixin~DataApi#function-getData `editor.getData()`} to-do list will be represented as the following HTML:
+When you call {@link module:core/editor/utils/dataapimixin~DataApi#function-getData `editor.getData()`}, a to-do list will be represented as the following HTML:
 
 ```html
 <ul class="todo-list">
@@ -78,7 +78,7 @@ For nested lists:
 
 ### Model representation
 
-From the technical point of view, to-do lists are built on top of the list feature. In the CKEditor 5 data model they are represented as a special `listType`, with optional `todoListChecked` attribute:
+From the technical point of view, to-do lists are built on top of the list feature. In the CKEditor 5 data model they are represented as a special `listType`, with an optional `todoListChecked` attribute:
 
 ```html
 <listItem listType="todo">Foo</listItem>

+ 17 - 17
packages/ckeditor5-list/src/converters.js

@@ -17,7 +17,7 @@ import {
 import TreeWalker from '@ckeditor/ckeditor5-engine/src/model/treewalker';
 
 /**
- * A model-to-view converter for `listItem` model element insertion.
+ * A model-to-view converter for the `listItem` model element insertion.
  *
  * It creates a `<ul><li></li><ul>` (or `<ol>`) view structure out of a `listItem` model element, inserts it at the correct
  * position, and merges the list with surrounding lists (if available).
@@ -49,7 +49,7 @@ export function modelViewInsertion( model ) {
 }
 
 /**
- * A model-to-view converter for `listItem` model element removal.
+ * A model-to-view converter for the `listItem` model element removal.
  *
  * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove
  * @param {module:engine/model/model~Model} model Model instance.
@@ -92,9 +92,9 @@ export function modelViewRemove( model ) {
 }
 
 /**
- * A model-to-view converter for `type` attribute change on `listItem` model element.
+ * A model-to-view converter for the `type` attribute change on the `listItem` model element.
  *
- * This change means that `<li>` elements parent changes from `<ul>` to `<ol>` (or vice versa). This is accomplished
+ * This change means that the `<li>` element parent changes from `<ul>` to `<ol>` (or vice versa). This is accomplished
  * by breaking view elements and changing their name. Next {@link module:list/converters~modelViewMergeAfterChangeType}
  * converter will try to merge split nodes.
  *
@@ -151,7 +151,7 @@ export function modelViewMergeAfterChangeType( evt, data, conversionApi ) {
 }
 
 /**
- * A model-to-view converter for `listIndent` attribute change on `listItem` model element.
+ * A model-to-view converter for the `listIndent` attribute change on the `listItem` model element.
  *
  * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
  * @param {module:engine/model/model~Model} model Model instance.
@@ -351,7 +351,7 @@ export function modelViewMergeAfter( evt, data, conversionApi ) {
 }
 
 /**
- * A view-to-model converter that converts `<li>` view elements into `listItem` model elements.
+ * A view-to-model converter that converts the `<li>` view elements into the `listItem` model elements.
  *
  * To set correct values of the `listType` and `listIndent` attributes the converter:
  * * checks `<li>`'s parent,
@@ -411,8 +411,8 @@ export function viewModelConverter( evt, data, conversionApi ) {
 }
 
 /**
- * A view-to-model converter for `<ul>` and `<ol>` view elements that cleans the input view of garbage.
- * This is mostly to clean whitespaces from between `<li>` view elements inside the view list element, however, also
+ * A view-to-model converter for the `<ul>` and `<ol>` view elements that cleans the input view of garbage.
+ * This is mostly to clean whitespaces from between the `<li>` view elements inside the view list element, however, also
  * incorrect data can be cleared if the view was incorrect.
  *
  * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
@@ -434,7 +434,7 @@ export function cleanList( evt, data, conversionApi ) {
 }
 
 /**
- * A view-to-model converter for `<li>` elements that cleans whitespace formatting from the input view.
+ * A view-to-model converter for the `<li>` elements that cleans whitespace formatting from the input view.
  *
  * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
  * @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
@@ -478,9 +478,9 @@ export function cleanListItem( evt, data, conversionApi ) {
 }
 
 /**
- * Returns callback for model position to view position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
- * positions between `listItem` elements that would be incorrectly mapped because of how list items are represented in model
- * and view.
+ * Returns a callback for model position to view position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
+ * positions between the `listItem` elements that would be incorrectly mapped because of how list items are represented in the model
+ * and in the view.
  *
  * @see module:engine/conversion/mapper~Mapper#event:modelToViewPosition
  * @param {module:engine/view/view~View} view A view instance.
@@ -516,8 +516,8 @@ export function modelToViewPosition( view ) {
 
 /**
  * The callback for view position to model position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
- * positions between `<li>` elements that would be incorrectly mapped because of how list items are represented in model
- * and view.
+ * positions between the `<li>` elements that would be incorrectly mapped because of how list items are represented in the model
+ * and in the view.
  *
  * @see module:engine/conversion/mapper~Mapper#event:viewToModelPosition
  * @param {module:engine/model/model~Model} model Model instance.
@@ -580,14 +580,14 @@ export function viewToModelPosition( model ) {
 /**
  * Post-fixer that reacts to changes on document and fixes incorrect model states.
  *
- * In an example below, there is a correct list structure.
- * Then the middle element will be removed so the list structure will become incorrect:
+ * In the example below, there is a correct list structure.
+ * Then the middle element is removed so the list structure will become incorrect:
  *
  *		<listItem listType="bulleted" listIndent=0>Item 1</listItem>
  *		<listItem listType="bulleted" listIndent=1>Item 2</listItem>   <--- this is removed.
  *		<listItem listType="bulleted" listIndent=2>Item 3</listItem>
  *
- * List structure after the middle element removed:
+ * The list structure after the middle element is removed:
  *
  * 		<listItem listType="bulleted" listIndent=0>Item 1</listItem>
  *		<listItem listType="bulleted" listIndent=2>Item 3</listItem>

+ 1 - 1
packages/ckeditor5-list/src/indentcommand.js

@@ -44,7 +44,7 @@ export default class IndentCommand extends Command {
 	}
 
 	/**
-	 * Indents or outdents (depends on the {@link #constructor}'s `indentDirection` parameter) selected list items.
+	 * Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
 	 *
 	 * @fires execute
 	 */

+ 1 - 1
packages/ckeditor5-list/src/list.js

@@ -15,7 +15,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 /**
  * The list feature.
  *
- * This is a "glue" plugin which loads the {@link module:list/listediting~ListEditing list editing feature}
+ * This is a "glue" plugin that loads the {@link module:list/listediting~ListEditing list editing feature}
  * and {@link module:list/listui~ListUI list UI feature}.
  *
  * @extends module:core/plugin~Plugin

+ 3 - 2
packages/ckeditor5-list/src/utils.js

@@ -11,7 +11,7 @@ import { getFillerOffset } from '@ckeditor/ckeditor5-engine/src/view/containerel
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 
 /**
- * Creates list item {@link module:engine/view/containerelement~ContainerElement}.
+ * Creates a list item {@link module:engine/view/containerelement~ContainerElement}.
  *
  * @param {module:engine/view/downcastwriter~DowncastWriter} writer The writer instance.
  * @returns {module:engine/view/containerelement~ContainerElement}
@@ -243,7 +243,8 @@ export function createUIComponent( editor, commandName, label, icon ) {
 		buttonView.set( {
 			label,
 			icon,
-			tooltip: true
+			tooltip: true,
+			isToggleable: true
 		} );
 
 		// Bind button model to command.

+ 3 - 0
packages/ckeditor5-list/tests/listui.js

@@ -43,7 +43,10 @@ describe( 'ListUI', () => {
 
 	it( 'should set up buttons for bulleted list and numbered list', () => {
 		expect( bulletedListButton ).to.be.instanceOf( ButtonView );
+		expect( bulletedListButton.isToggleable ).to.be.true;
+
 		expect( numberedListButton ).to.be.instanceOf( ButtonView );
+		expect( numberedListButton.isToggleable ).to.be.true;
 	} );
 
 	it( 'should execute proper commands when buttons are used', () => {