Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into t/115
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Aug 26, 2019
2 parents c622df4 + b550f6b commit a1afb15
Show file tree
Hide file tree
Showing 18 changed files with 300 additions and 221 deletions.
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Changelog
=========

## [12.1.0](https://github.com/ckeditor/ckeditor5-list/compare/v12.0.4...v12.1.0) (2019-08-26)

### Features

* Introduced to-do lists. Closes [ckeditor/ckeditor5#1434](https://github.com/ckeditor/ckeditor5/issues/1434). ([56a7a7a](https://github.com/ckeditor/ckeditor5-list/commit/56a7a7a))

### Bug fixes

* The UI buttons should be marked as toggleable for better assistive technologies support (see [ckeditor/ckeditor5#1403](https://github.com/ckeditor/ckeditor5/issues/1403)). ([bb12325](https://github.com/ckeditor/ckeditor5-list/commit/bb12325))

### Other changes

* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([5507ac6](https://github.com/ckeditor/ckeditor5-list/commit/5507ac6))
* Updated translations. ([10e296d](https://github.com/ckeditor/ckeditor5-list/commit/10e296d))


## [12.0.4](https://github.com/ckeditor/ckeditor5-list/compare/v12.0.3...v12.0.4) (2019-07-10)

Internal changes only (updated dependencies, documentation, etc.).
Expand All @@ -13,21 +29,21 @@ Internal changes only (updated dependencies, documentation, etc.).
* Attach `'indentList'` and `'outdentList'` commands to `'indent'` and `'outdent'` commands. ([3a67531](https://github.com/ckeditor/ckeditor5-list/commit/3a67531))

The `@ckeditor/ckeditor5-indent` feature introduces the "indent" and "outdent" buttons which can be used to manipulate lists and other blocks.
* Updated translations. ([6c4b520](https://github.com/ckeditor/ckeditor5-list/commit/6c4b520))
* Updated translations. ([6c4b520](https://github.com/ckeditor/ckeditor5-list/commit/6c4b520))


## [12.0.2](https://github.com/ckeditor/ckeditor5-list/compare/v12.0.1...v12.0.2) (2019-06-05)

### Other changes

* Updated translations. ([b7f3abc](https://github.com/ckeditor/ckeditor5-list/commit/b7f3abc))
* Updated translations. ([b7f3abc](https://github.com/ckeditor/ckeditor5-list/commit/b7f3abc))


## [12.0.1](https://github.com/ckeditor/ckeditor5-list/compare/v12.0.0...v12.0.1) (2019-04-10)

### Other changes

* Updated translations. ([d595449](https://github.com/ckeditor/ckeditor5-list/commit/d595449))
* Updated translations. ([d595449](https://github.com/ckeditor/ckeditor5-list/commit/d595449))


## [12.0.0](https://github.com/ckeditor/ckeditor5-list/compare/v11.0.3...v12.0.0) (2019-02-28)
Expand Down
6 changes: 3 additions & 3 deletions docs/_snippets/features/todo-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud

import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';

// import TodoList from '@ckeditor/ckeditor5-list/src/todolist';
import TodoList from '@ckeditor/ckeditor5-list/src/todolist';

// ClassicEditor.builtinPlugins.push( TodoList );
ClassicEditor.builtinPlugins.push( TodoList );

ClassicEditor
.create( document.querySelector( '#snippet-todo-list' ), {
Expand All @@ -22,7 +22,7 @@ ClassicEditor
'|',
'bulletedList',
'numberedList',
// 'todoList',
'todoList',
'|',
'link',
'insertTable',
Expand Down
6 changes: 3 additions & 3 deletions docs/features/todo-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ category: features

# To-do lists

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.
The {@link module:list/todolist~TodoList 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

{@snippet features/todo-list}

## Keyboard support

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.
You can check and uncheck a list item by using the <kbd>Ctrl</kbd> + <kbd>Space</kbd> shortcut when the selection is in that item.

## Installation

Expand Down Expand Up @@ -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 an optional `todoListChecked` attribute:
From the technical point of view, to-do lists are built on top of the {@link module:list/list~List 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>
Expand Down
5 changes: 3 additions & 2 deletions lang/contexts.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"Numbered List": "Toolbar button tooltip for the Numbered List feature.",
"Bulleted List": "Toolbar button tooltip for the Bulleted List feature."
}
"Bulleted List": "Toolbar button tooltip for the Bulleted List feature.",
"To-do List": "Toolbar button tooltip for the To-do List feature."
}
25 changes: 25 additions & 0 deletions lang/translations/en-gb.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
#
# !!! IMPORTANT !!!
#
# Before you edit this file, please keep in mind that contributing to the project
# translations is possible ONLY via the Transifex online service.
#
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
#
# To learn more, check out the official contributor's guide:
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
#
msgid ""
msgstr ""
"Language-Team: English (United Kingdom) (https://www.transifex.com/ckeditor/teams/11143/en_GB/)\n"
"Language: en_GB\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgctxt "Toolbar button tooltip for the Numbered List feature."
msgid "Numbered List"
msgstr "Numbered List"

msgctxt "Toolbar button tooltip for the Bulleted List feature."
msgid "Bulleted List"
msgstr "Bulleted List"
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ckeditor/ckeditor5-list",
"version": "12.0.4",
"version": "12.1.0",
"description": "Ordered and unordered lists feature to CKEditor 5.",
"keywords": [
"ckeditor",
Expand All @@ -10,25 +10,25 @@
"ckeditor5-plugin"
],
"dependencies": {
"@ckeditor/ckeditor5-core": "^12.2.1",
"@ckeditor/ckeditor5-engine": "^13.2.1",
"@ckeditor/ckeditor5-paragraph": "^11.0.4",
"@ckeditor/ckeditor5-ui": "^13.0.2",
"@ckeditor/ckeditor5-utils": "^13.0.1"
"@ckeditor/ckeditor5-core": "^12.3.0",
"@ckeditor/ckeditor5-engine": "^14.0.0",
"@ckeditor/ckeditor5-paragraph": "^11.0.5",
"@ckeditor/ckeditor5-ui": "^14.0.0",
"@ckeditor/ckeditor5-utils": "^14.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^11.1.3",
"@ckeditor/ckeditor5-block-quote": "^11.1.2",
"@ckeditor/ckeditor5-clipboard": "^12.0.1",
"@ckeditor/ckeditor5-editor-classic": "^12.1.3",
"@ckeditor/ckeditor5-enter": "^11.0.4",
"@ckeditor/ckeditor5-heading": "^11.0.4",
"@ckeditor/ckeditor5-highlight": "^11.0.4",
"@ckeditor/ckeditor5-indent": "^10.0.1",
"@ckeditor/ckeditor5-link": "^11.1.1",
"@ckeditor/ckeditor5-table": "^13.0.2",
"@ckeditor/ckeditor5-typing": "^12.1.1",
"@ckeditor/ckeditor5-undo": "^11.0.4",
"@ckeditor/ckeditor5-basic-styles": "^11.1.4",
"@ckeditor/ckeditor5-block-quote": "^11.1.3",
"@ckeditor/ckeditor5-clipboard": "^12.0.2",
"@ckeditor/ckeditor5-editor-classic": "^12.1.4",
"@ckeditor/ckeditor5-enter": "^11.1.0",
"@ckeditor/ckeditor5-heading": "^11.0.5",
"@ckeditor/ckeditor5-highlight": "^11.0.5",
"@ckeditor/ckeditor5-indent": "^10.1.0",
"@ckeditor/ckeditor5-link": "^11.1.2",
"@ckeditor/ckeditor5-table": "^14.0.0",
"@ckeditor/ckeditor5-typing": "^12.2.0",
"@ckeditor/ckeditor5-undo": "^11.0.5",
"eslint": "^5.5.0",
"eslint-config-ckeditor5": "^2.0.0",
"husky": "^1.3.1",
Expand All @@ -41,7 +41,7 @@
"author": "CKSource (http://cksource.com/)",
"license": "GPL-2.0-or-later",
"homepage": "https://ckeditor.com/ckeditor-5",
"bugs": "https://github.com/ckeditor/ckeditor5-list/issues",
"bugs": "https://github.com/ckeditor/ckeditor5/issues",
"repository": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor5-list.git"
Expand Down
6 changes: 3 additions & 3 deletions src/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export function modelViewRemove( model ) {
* A model-to-view converter for the `type` attribute change on the `listItem` model element.
*
* 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.
* by breaking view elements and changing their name. The next {@link module:list/converters~modelViewMergeAfterChangeType}
* converter will attempt to merge split nodes.
*
* Splitting this conversion into 2 steps makes it possible to add an additional conversion in the middle.
* Check {@link module:list/todolistconverters~modelViewChangeType} to see an example of it.
Expand Down Expand Up @@ -128,7 +128,7 @@ export function modelViewChangeType( evt, data, conversionApi ) {
}

/**
* A model-to-view converter that try to merge nodes split by {@link module:list/converters~modelViewChangeType}.
* A model-to-view converter that attempts to merge nodes split by {@link module:list/converters~modelViewChangeType}.
*
* @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
* @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
Expand Down
8 changes: 4 additions & 4 deletions src/todolist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import TodoListUI from './todolistui';
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

/**
* The todo list feature.
* The to-do list feature.
*
* This is a "glue" plugin which loads the {@link module:list/todolistediting~TodoListEditing todo list editing feature}
* and {@link module:list/todolistui~TodoListUI list UI feature}.
* This is a "glue" plugin that loads the {@link module:list/todolistediting~TodoListEditing to-do list editing feature}
* and the {@link module:list/todolistui~TodoListUI to-do list UI feature}.
*
* @extends module:core/plugin~Plugin
*/
export default class List extends Plugin {
export default class TodoList extends Plugin {
/**
* @inheritDoc
*/
Expand Down
27 changes: 17 additions & 10 deletions src/todolistcheckcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ export default class TodoListCheckCommand extends Command {
super( editor );

/**
* Flag indicating whether the command is active. The command is active when at least one of
* {@link module:engine/model/selection~Selection selected} elements is a todo list item.
* A flag indicating whether the command is active. The command is active when at least one of
* {@link module:engine/model/selection~Selection selected} elements is a to-do list item.
*
* @observable
* @readonly
* @member {Boolean} #isEnabled
*/

/**
* A List of todo list item selected by the {@link module:engine/model/selection~Selection}.
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
*
* @observable
* @readonly
* @member {Array.<module:engine/model/element~Element>} #value
*/

/**
* List of todo list items selected by the {@link module:engine/model/selection~Selection}.
* A list of to-do list items selected by the {@link module:engine/model/selection~Selection}.
*
* @protected
* @type {Array.<module:engine/model/element~Element>}
* @private
*/
this._selectedElements = [];

Expand All @@ -54,7 +54,7 @@ export default class TodoListCheckCommand extends Command {
}

/**
* Updates the command's {@link #value} and {@link #isEnabled} based on the current selection.
* Updates the command's {@link #value} and {@link #isEnabled} properties based on the current selection.
*/
refresh() {
this._selectedElements = this._getSelectedItems();
Expand All @@ -63,7 +63,7 @@ export default class TodoListCheckCommand extends Command {
}

/**
* Gets all todo list items selected by the {@link module:engine/model/selection~Selection}.
* Gets all to-do list items selected by the {@link module:engine/model/selection~Selection}.
*
* @private
* @returns {Array.<module:engine/model/element~Element>}
Expand All @@ -90,12 +90,19 @@ export default class TodoListCheckCommand extends Command {
}

/**
* @inheritDoc
* Executes the command.
*
* @param {Object} [options]
* @param {Boolean} [options.forceValue] If set, it will force the command behavior. If `true`, the command will apply
* the attribute. Otherwise, the command will remove the attribute. If not set, the command will look for its current
* value to decide what it should do.
*/
execute() {
execute( options = {} ) {
this.editor.model.change( writer => {
for ( const element of this._selectedElements ) {
if ( !this.value ) {
const value = ( options.forceValue === undefined ) ? !this.value : options.forceValue;

if ( value ) {
writer.setAttribute( attributeKey, true, element );
} else {
writer.removeAttribute( attributeKey, element );
Expand Down
Loading

0 comments on commit a1afb15

Please sign in to comment.