@ckeditor/ckeditor5-list 32.0.0 → 34.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/build/list.js +2 -2
- package/build/list.js.map +1 -0
- package/build/translations/cs.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/jv.js +1 -0
- package/build/translations/pt-br.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/ckeditor5-metadata.json +1 -1
- package/lang/translations/cs.po +4 -4
- package/lang/translations/de.po +4 -4
- package/lang/translations/el.po +27 -27
- package/lang/translations/en-au.po +4 -4
- package/lang/translations/es.po +22 -22
- package/lang/translations/gl.po +4 -4
- package/lang/translations/it.po +4 -4
- package/lang/translations/jv.po +125 -0
- package/lang/translations/pt-br.po +4 -4
- package/lang/translations/sk.po +4 -4
- package/lang/translations/sr-latn.po +4 -4
- package/lang/translations/sr.po +4 -4
- package/package.json +36 -24
- package/src/documentlist/converters.js +470 -0
- package/src/documentlist/documentlistcommand.js +216 -0
- package/src/documentlist/documentlistediting.js +676 -0
- package/src/documentlist/documentlistindentcommand.js +182 -0
- package/src/documentlist/documentlistmergecommand.js +235 -0
- package/src/documentlist/documentlistsplitcommand.js +114 -0
- package/src/documentlist/utils/listwalker.js +260 -0
- package/src/documentlist/utils/model.js +534 -0
- package/src/documentlist/utils/postfixers.js +138 -0
- package/src/documentlist/utils/view.js +148 -0
- package/src/documentlist.js +36 -0
- package/src/documentlistproperties/converters.js +57 -0
- package/src/documentlistproperties/documentlistpropertiesediting.js +338 -0
- package/src/documentlistproperties/documentlistreversedcommand.js +76 -0
- package/src/documentlistproperties/documentliststartcommand.js +76 -0
- package/src/documentlistproperties/documentliststylecommand.js +140 -0
- package/src/documentlistproperties/utils/style.js +41 -0
- package/src/documentlistproperties.js +37 -0
- package/src/index.js +10 -6
- package/src/{converters.js → list/converters.js} +11 -10
- package/src/{indentcommand.js → list/indentcommand.js} +1 -1
- package/src/{listcommand.js → list/listcommand.js} +1 -1
- package/src/{listediting.js → list/listediting.js} +11 -12
- package/src/{listui.js → list/listui.js} +3 -3
- package/src/{utils.js → list/utils.js} +35 -4
- package/src/list.js +7 -6
- package/src/{listpropertiesediting.js → listproperties/listpropertiesediting.js} +6 -5
- package/src/{listpropertiesui.js → listproperties/listpropertiesui.js} +15 -16
- package/src/{listreversedcommand.js → listproperties/listreversedcommand.js} +3 -3
- package/src/{liststartcommand.js → listproperties/liststartcommand.js} +3 -3
- package/src/{liststylecommand.js → listproperties/liststylecommand.js} +36 -4
- package/src/{ui → listproperties/ui}/collapsibleview.js +1 -1
- package/src/{ui → listproperties/ui}/listpropertiesview.js +1 -1
- package/src/listproperties.js +14 -9
- package/src/{checktodolistcommand.js → todolist/checktodolistcommand.js} +2 -2
- package/src/{todolistconverters.js → todolist/todolistconverters.js} +8 -4
- package/src/{todolistediting.js → todolist/todolistediting.js} +4 -4
- package/src/{todolistui.js → todolist/todolistui.js} +3 -3
- package/src/todolist.js +4 -4
- package/theme/documentlist.css +8 -0
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/listreversedcommand
|
|
7
|
+
* @module list/listproperties/listreversedcommand
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
11
|
-
import { getSelectedListItems } from '
|
|
11
|
+
import { getSelectedListItems } from '../list/utils';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The reversed list command. It changes the `listReversed` attribute of the selected list items. As a result, the list order will be
|
|
@@ -30,9 +30,9 @@ export default class ListReversedCommand extends Command {
|
|
|
30
30
|
/**
|
|
31
31
|
* Executes the command.
|
|
32
32
|
*
|
|
33
|
+
* @fires execute
|
|
33
34
|
* @param {Object} options
|
|
34
35
|
* @param {Boolean} [options.reversed=false] Whether the list should be reversed.
|
|
35
|
-
* @protected
|
|
36
36
|
*/
|
|
37
37
|
execute( options = {} ) {
|
|
38
38
|
const model = this.editor.model;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/liststartcommand
|
|
7
|
+
* @module list/listproperties/liststartcommand
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
11
|
-
import { getSelectedListItems } from '
|
|
11
|
+
import { getSelectedListItems } from '../list/utils';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The list start index command. It changes the `listStart` attribute of the selected list items.
|
|
@@ -29,9 +29,9 @@ export default class ListStartCommand extends Command {
|
|
|
29
29
|
/**
|
|
30
30
|
* Executes the command.
|
|
31
31
|
*
|
|
32
|
+
* @fires execute
|
|
32
33
|
* @param {Object} options
|
|
33
34
|
* @param {Number} [options.startIndex=1] The list start index.
|
|
34
|
-
* @protected
|
|
35
35
|
*/
|
|
36
36
|
execute( options = {} ) {
|
|
37
37
|
const model = this.editor.model;
|
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/liststylecommand
|
|
7
|
+
* @module list/listproperties/liststylecommand
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
11
|
-
import { getSelectedListItems } from '
|
|
11
|
+
import { getListTypeFromListStyleType, getSelectedListItems } from '../list/utils';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The list style command. It changes the `listStyle` attribute of the selected list items.
|
|
15
|
+
*
|
|
16
|
+
* If the list type (numbered or bulleted) can be inferred from the passed style type,
|
|
17
|
+
* the command tries to convert selected items to a list of that type.
|
|
15
18
|
* It is used by the {@link module:list/listproperties~ListProperties list properties feature}.
|
|
16
19
|
*
|
|
17
20
|
* @extends module:core/command~Command
|
|
@@ -47,12 +50,14 @@ export default class ListStyleCommand extends Command {
|
|
|
47
50
|
/**
|
|
48
51
|
* Executes the command.
|
|
49
52
|
*
|
|
53
|
+
* @fires execute
|
|
50
54
|
* @param {Object} options
|
|
51
|
-
* @param {String|null} options.type The type of the list style, e.g. `'disc'` or `'square'`. If `null` is specified, the default
|
|
55
|
+
* @param {String|null} [options.type] The type of the list style, e.g. `'disc'` or `'square'`. If `null` is specified, the default
|
|
52
56
|
* style will be applied.
|
|
53
|
-
* @protected
|
|
54
57
|
*/
|
|
55
58
|
execute( options = {} ) {
|
|
59
|
+
this._tryToConvertItemsToList( options );
|
|
60
|
+
|
|
56
61
|
const model = this.editor.model;
|
|
57
62
|
const listItems = getSelectedListItems( model );
|
|
58
63
|
|
|
@@ -97,4 +102,31 @@ export default class ListStyleCommand extends Command {
|
|
|
97
102
|
|
|
98
103
|
return numberedList.isEnabled || bulletedList.isEnabled;
|
|
99
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Check if the provided list style is valid. Also change the selection to a list if it's not set yet.
|
|
108
|
+
*
|
|
109
|
+
* @param {Object} options
|
|
110
|
+
* @param {String|null} [options.type] The type of the list style. If `null` is specified, the function does nothing.
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
_tryToConvertItemsToList( options ) {
|
|
114
|
+
if ( !options.type ) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const listType = getListTypeFromListStyleType( options.type );
|
|
119
|
+
|
|
120
|
+
if ( !listType ) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const editor = this.editor;
|
|
125
|
+
const commandName = listType + 'List';
|
|
126
|
+
const command = editor.commands.get( commandName );
|
|
127
|
+
|
|
128
|
+
if ( !command.value ) {
|
|
129
|
+
editor.execute( commandName );
|
|
130
|
+
}
|
|
131
|
+
}
|
|
100
132
|
}
|
|
@@ -12,7 +12,7 @@ import { View, ButtonView } from 'ckeditor5/src/ui';
|
|
|
12
12
|
// eslint-disable-next-line ckeditor5-rules/ckeditor-imports
|
|
13
13
|
import dropdownArrowIcon from '@ckeditor/ckeditor5-ui/theme/icons/dropdown-arrow.svg';
|
|
14
14
|
|
|
15
|
-
import '
|
|
15
|
+
import '../../../theme/collapsible.css';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A collapsible UI component. Consists of a labeled button and a container which can be collapsed
|
package/src/listproperties.js
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
|
-
import ListPropertiesEditing from './listpropertiesediting';
|
|
12
|
-
import ListPropertiesUI from './listpropertiesui';
|
|
11
|
+
import ListPropertiesEditing from './listproperties/listpropertiesediting';
|
|
12
|
+
import ListPropertiesUI from './listproperties/listpropertiesui';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The list properties feature.
|
|
16
16
|
*
|
|
17
|
-
* This is a "glue" plugin that loads the {@link module:list/listpropertiesediting~ListPropertiesEditing list properties
|
|
18
|
-
* and the {@link module:list/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
17
|
+
* This is a "glue" plugin that loads the {@link module:list/listproperties/listpropertiesediting~ListPropertiesEditing list properties
|
|
18
|
+
* editing feature} and the {@link module:list/listproperties/listpropertiesui~ListPropertiesUI list properties UI feature}.
|
|
19
19
|
*
|
|
20
20
|
* @extends module:core/plugin~Plugin
|
|
21
21
|
*/
|
|
@@ -36,12 +36,16 @@ export default class ListProperties extends Plugin {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature
|
|
39
|
+
* The configuration of the {@link module:list/listproperties~ListProperties list properties} feature and the
|
|
40
|
+
* {@link module:list/documentlistproperties~DocumentListProperties document list properties} feature.
|
|
40
41
|
*
|
|
41
42
|
* This configuration controls the individual list properties. For instance, it enables or disables specific editor commands
|
|
42
|
-
* operating on lists ({@link module:list/liststylecommand~ListStyleCommand `'listStyle'`},
|
|
43
|
-
* {@link module:list/liststartcommand~ListStartCommand `'listStart'`},
|
|
44
|
-
* {@link module:list/listreversedcommand~ListReversedCommand `'listReversed'`}
|
|
43
|
+
* operating on lists ({@link module:list/listproperties/liststylecommand~ListStyleCommand `'listStyle'`},
|
|
44
|
+
* {@link module:list/listproperties/liststartcommand~ListStartCommand `'listStart'`},
|
|
45
|
+
* {@link module:list/listproperties/listreversedcommand~ListReversedCommand `'listReversed'`}, or on the document lists
|
|
46
|
+
* {@link module:list/documentlistproperties/documentliststylecommand~DocumentListStyleCommand `'listStyle'`},
|
|
47
|
+
* {@link module:list/documentlistproperties/documentliststartcommand~DocumentListStartCommand `'listStart'`},
|
|
48
|
+
* {@link module:list/documentlistproperties/documentlistreversedcommand~DocumentListReversedCommand `'listReversed'`}), the look of the UI
|
|
45
49
|
* (`'numberedList'` and `'bulletedList'` dropdowns), and the editor data pipeline (allowed HTML attributes).
|
|
46
50
|
*
|
|
47
51
|
* ClassicEditor
|
|
@@ -88,7 +92,8 @@ export default class ListProperties extends Plugin {
|
|
|
88
92
|
*/
|
|
89
93
|
|
|
90
94
|
/**
|
|
91
|
-
* The configuration of the {@link module:list/listproperties~ListProperties} feature
|
|
95
|
+
* The configuration of the {@link module:list/listproperties~ListProperties} feature and the
|
|
96
|
+
* {@link module:list/documentlistproperties~DocumentListProperties document list properties} feature.
|
|
92
97
|
*
|
|
93
98
|
* Read more in {@link module:list/listproperties~ListPropertiesConfig}.
|
|
94
99
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/checktodolistcommand
|
|
7
|
+
* @module list/todolist/checktodolistcommand
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Command } from 'ckeditor5/src/core';
|
|
@@ -14,7 +14,7 @@ const attributeKey = 'todoListChecked';
|
|
|
14
14
|
/**
|
|
15
15
|
* The check to-do command.
|
|
16
16
|
*
|
|
17
|
-
* The command is registered by the {@link module:list/todolistediting~TodoListEditing} as
|
|
17
|
+
* The command is registered by the {@link module:list/todolist/todolistediting~TodoListEditing} as
|
|
18
18
|
* the `checkTodoList` editor command and it is also available via aliased `todoListCheck` name.
|
|
19
19
|
*
|
|
20
20
|
* @extends module:core/command~Command
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/todolistconverters
|
|
7
|
+
* @module list/todolist/todolistconverters
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/* global document */
|
|
11
11
|
|
|
12
12
|
import { createElement } from 'ckeditor5/src/utils';
|
|
13
13
|
|
|
14
|
-
import { generateLiInUl, injectViewList, positionAfterUiElements, findNestedList } from '
|
|
14
|
+
import { generateLiInUl, injectViewList, positionAfterUiElements, findNestedList } from '../list/utils';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* A model-to-view converter for the `listItem` model element insertion.
|
|
@@ -171,8 +171,8 @@ export function dataViewModelCheckmarkInsertion( evt, data, conversionApi ) {
|
|
|
171
171
|
* {@link module:engine/view/uielement~UIElement checkbox UI element} is added at the beginning
|
|
172
172
|
* of the list item element (or vice versa).
|
|
173
173
|
*
|
|
174
|
-
* This converter is preceded by {@link module:list/converters~modelViewChangeType} and followed by
|
|
175
|
-
* {@link module:list/converters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists of the same type.
|
|
174
|
+
* This converter is preceded by {@link module:list/list/converters~modelViewChangeType} and followed by
|
|
175
|
+
* {@link module:list/list/converters~modelViewMergeAfterChangeType} to handle splitting and merging surrounding lists of the same type.
|
|
176
176
|
*
|
|
177
177
|
* It is used by {@link module:engine/controller/editingcontroller~EditingController}.
|
|
178
178
|
*
|
|
@@ -183,6 +183,10 @@ export function dataViewModelCheckmarkInsertion( evt, data, conversionApi ) {
|
|
|
183
183
|
*/
|
|
184
184
|
export function modelViewChangeType( onCheckedChange, view ) {
|
|
185
185
|
return ( evt, data, conversionApi ) => {
|
|
186
|
+
if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
186
190
|
const viewItem = conversionApi.mapper.toViewElement( data.item );
|
|
187
191
|
const viewWriter = conversionApi.writer;
|
|
188
192
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/todolistediting
|
|
7
|
+
* @module list/todolist/todolistediting
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core';
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
getLocalizedArrowKeyCodeDirection
|
|
15
15
|
} from 'ckeditor5/src/utils';
|
|
16
16
|
|
|
17
|
-
import ListCommand from '
|
|
18
|
-
import ListEditing from '
|
|
17
|
+
import ListCommand from '../list/listcommand';
|
|
18
|
+
import ListEditing from '../list/listediting';
|
|
19
19
|
import CheckTodoListCommand from './checktodolistcommand';
|
|
20
20
|
import {
|
|
21
21
|
dataModelViewInsertion,
|
|
@@ -31,7 +31,7 @@ const ITEM_TOGGLE_KEYSTROKE = parseKeystroke( 'Ctrl+Enter' );
|
|
|
31
31
|
/**
|
|
32
32
|
* The engine of the to-do list feature. It handles creating, editing and removing to-do lists and their items.
|
|
33
33
|
*
|
|
34
|
-
* It registers the entire functionality of the {@link module:list/listediting~ListEditing list editing plugin} and extends
|
|
34
|
+
* It registers the entire functionality of the {@link module:list/list/listediting~ListEditing list editing plugin} and extends
|
|
35
35
|
* it with the commands:
|
|
36
36
|
*
|
|
37
37
|
* - `'todoList'`,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @module list/todolistui
|
|
7
|
+
* @module list/todolist/todolistui
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { createUIComponent } from '
|
|
11
|
-
import todoListIcon from '
|
|
10
|
+
import { createUIComponent } from '../list/utils';
|
|
11
|
+
import todoListIcon from '../../theme/icons/todolist.svg';
|
|
12
12
|
import { Plugin } from 'ckeditor5/src/core';
|
|
13
13
|
|
|
14
14
|
/**
|
package/src/todolist.js
CHANGED
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
* @module list/todolist
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import TodoListEditing from './todolistediting';
|
|
11
|
-
import TodoListUI from './todolistui';
|
|
10
|
+
import TodoListEditing from './todolist/todolistediting';
|
|
11
|
+
import TodoListUI from './todolist/todolistui';
|
|
12
12
|
import { Plugin } from 'ckeditor5/src/core';
|
|
13
13
|
import '../theme/todolist.css';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The to-do list feature.
|
|
17
17
|
*
|
|
18
|
-
* This is a "glue" plugin that loads the {@link module:list/todolistediting~TodoListEditing to-do list editing feature}
|
|
19
|
-
* and the {@link module:list/todolistui~TodoListUI to-do list UI feature}.
|
|
18
|
+
* This is a "glue" plugin that loads the {@link module:list/todolist/todolistediting~TodoListEditing to-do list editing feature}
|
|
19
|
+
* and the {@link module:list/todolist/todolistui~TodoListUI to-do list UI feature}.
|
|
20
20
|
*
|
|
21
21
|
* @extends module:core/plugin~Plugin
|
|
22
22
|
*/
|