@ckeditor/ckeditor5-list 41.1.0 → 41.3.0-alpha.0

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.
Files changed (190) hide show
  1. package/build/list.js +2 -2
  2. package/build/translations/ar.js +1 -1
  3. package/build/translations/ast.js +1 -1
  4. package/build/translations/az.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de-ch.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/en-gb.js +1 -1
  15. package/build/translations/eo.js +1 -1
  16. package/build/translations/es.js +1 -1
  17. package/build/translations/et.js +1 -1
  18. package/build/translations/eu.js +1 -1
  19. package/build/translations/fa.js +1 -1
  20. package/build/translations/fi.js +1 -1
  21. package/build/translations/fr.js +1 -1
  22. package/build/translations/gl.js +1 -1
  23. package/build/translations/he.js +1 -1
  24. package/build/translations/hi.js +1 -1
  25. package/build/translations/hr.js +1 -1
  26. package/build/translations/hu.js +1 -1
  27. package/build/translations/id.js +1 -1
  28. package/build/translations/it.js +1 -1
  29. package/build/translations/ja.js +1 -1
  30. package/build/translations/jv.js +1 -1
  31. package/build/translations/km.js +1 -1
  32. package/build/translations/kn.js +1 -1
  33. package/build/translations/ko.js +1 -1
  34. package/build/translations/ku.js +1 -1
  35. package/build/translations/lt.js +1 -1
  36. package/build/translations/lv.js +1 -1
  37. package/build/translations/ms.js +1 -1
  38. package/build/translations/nb.js +1 -1
  39. package/build/translations/ne.js +1 -1
  40. package/build/translations/nl.js +1 -1
  41. package/build/translations/no.js +1 -1
  42. package/build/translations/pl.js +1 -1
  43. package/build/translations/pt-br.js +1 -1
  44. package/build/translations/pt.js +1 -1
  45. package/build/translations/ro.js +1 -1
  46. package/build/translations/ru.js +1 -1
  47. package/build/translations/si.js +1 -1
  48. package/build/translations/sk.js +1 -1
  49. package/build/translations/sq.js +1 -1
  50. package/build/translations/sr-latn.js +1 -1
  51. package/build/translations/sr.js +1 -1
  52. package/build/translations/sv.js +1 -1
  53. package/build/translations/th.js +1 -1
  54. package/build/translations/tk.js +1 -1
  55. package/build/translations/tr.js +1 -1
  56. package/build/translations/tt.js +1 -1
  57. package/build/translations/ug.js +1 -1
  58. package/build/translations/uk.js +1 -1
  59. package/build/translations/ur.js +1 -1
  60. package/build/translations/uz.js +1 -1
  61. package/build/translations/vi.js +1 -1
  62. package/build/translations/zh-cn.js +1 -1
  63. package/build/translations/zh.js +1 -1
  64. package/dist/content-index.css +102 -0
  65. package/dist/editor-index.css +74 -0
  66. package/dist/index.css +228 -0
  67. package/dist/index.css.map +1 -0
  68. package/dist/index.js +7925 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/types/augmentation.d.ts +53 -0
  71. package/dist/types/documentlist.d.ts +28 -0
  72. package/dist/types/documentlistproperties.d.ts +28 -0
  73. package/dist/types/index.d.ts +45 -0
  74. package/dist/types/legacylist/legacyconverters.d.ts +196 -0
  75. package/dist/types/legacylist/legacyindentcommand.d.ts +37 -0
  76. package/dist/types/legacylist/legacylistcommand.d.ts +55 -0
  77. package/dist/types/legacylist/legacylistediting.d.ts +32 -0
  78. package/dist/types/legacylist/legacylistutils.d.ts +41 -0
  79. package/dist/types/legacylist/legacyutils.d.ts +101 -0
  80. package/dist/types/legacylist.d.ts +26 -0
  81. package/dist/types/legacylistproperties/legacylistpropertiesediting.d.ts +72 -0
  82. package/dist/types/legacylistproperties/legacylistreversedcommand.d.ts +38 -0
  83. package/dist/types/legacylistproperties/legacyliststartcommand.d.ts +37 -0
  84. package/dist/types/legacylistproperties/legacyliststylecommand.d.ts +67 -0
  85. package/dist/types/legacylistproperties.d.ts +27 -0
  86. package/dist/types/legacytodolist/legacychecktodolistcommand.d.ts +52 -0
  87. package/dist/types/legacytodolist/legacytodolistconverters.d.ts +83 -0
  88. package/dist/types/legacytodolist/legacytodolistediting.d.ts +39 -0
  89. package/dist/types/legacytodolist.d.ts +27 -0
  90. package/dist/types/list/adjacentlistssupport.d.ts +15 -0
  91. package/dist/types/list/converters.d.ts +65 -0
  92. package/dist/types/list/listcommand.d.ts +80 -0
  93. package/dist/types/list/listediting.d.ts +216 -0
  94. package/dist/types/list/listindentcommand.d.ts +62 -0
  95. package/dist/types/list/listmergecommand.d.ts +76 -0
  96. package/dist/types/list/listsplitcommand.d.ts +67 -0
  97. package/dist/types/list/listui.d.ts +19 -0
  98. package/dist/types/list/listutils.d.ts +46 -0
  99. package/dist/types/list/utils/listwalker.d.ts +145 -0
  100. package/dist/types/list/utils/model.d.ts +202 -0
  101. package/dist/types/list/utils/postfixers.d.ts +37 -0
  102. package/dist/types/list/utils/view.d.ts +81 -0
  103. package/dist/types/list/utils.d.ts +18 -0
  104. package/dist/types/list.d.ts +26 -0
  105. package/dist/types/listconfig.d.ts +132 -0
  106. package/dist/types/listproperties/converters.d.ts +19 -0
  107. package/dist/types/listproperties/listpropertiesediting.d.ts +88 -0
  108. package/dist/types/listproperties/listpropertiesui.d.ts +23 -0
  109. package/dist/types/listproperties/listpropertiesutils.d.ts +33 -0
  110. package/dist/types/listproperties/listreversedcommand.d.ts +36 -0
  111. package/dist/types/listproperties/liststartcommand.d.ts +38 -0
  112. package/dist/types/listproperties/liststylecommand.d.ts +72 -0
  113. package/dist/types/listproperties/ui/listpropertiesview.d.ts +156 -0
  114. package/dist/types/listproperties/utils/style.d.ts +20 -0
  115. package/dist/types/listproperties.d.ts +27 -0
  116. package/dist/types/tododocumentlist.d.ts +28 -0
  117. package/dist/types/todolist/checktodolistcommand.d.ts +49 -0
  118. package/dist/types/todolist/todocheckboxchangeobserver.d.ts +41 -0
  119. package/dist/types/todolist/todolistediting.d.ts +38 -0
  120. package/dist/types/todolist/todolistui.d.ts +19 -0
  121. package/dist/types/todolist.d.ts +27 -0
  122. package/lang/contexts.json +5 -1
  123. package/lang/translations/ar.po +16 -0
  124. package/lang/translations/ast.po +16 -0
  125. package/lang/translations/az.po +16 -0
  126. package/lang/translations/bg.po +16 -0
  127. package/lang/translations/bn.po +16 -0
  128. package/lang/translations/ca.po +16 -0
  129. package/lang/translations/cs.po +16 -0
  130. package/lang/translations/da.po +16 -0
  131. package/lang/translations/de-ch.po +16 -0
  132. package/lang/translations/de.po +16 -0
  133. package/lang/translations/el.po +16 -0
  134. package/lang/translations/en-au.po +16 -0
  135. package/lang/translations/en-gb.po +16 -0
  136. package/lang/translations/en.po +16 -0
  137. package/lang/translations/eo.po +16 -0
  138. package/lang/translations/es.po +16 -0
  139. package/lang/translations/et.po +16 -0
  140. package/lang/translations/eu.po +16 -0
  141. package/lang/translations/fa.po +16 -0
  142. package/lang/translations/fi.po +16 -0
  143. package/lang/translations/fr.po +16 -0
  144. package/lang/translations/gl.po +16 -0
  145. package/lang/translations/he.po +17 -1
  146. package/lang/translations/hi.po +16 -0
  147. package/lang/translations/hr.po +16 -0
  148. package/lang/translations/hu.po +16 -0
  149. package/lang/translations/id.po +16 -0
  150. package/lang/translations/it.po +16 -0
  151. package/lang/translations/ja.po +16 -0
  152. package/lang/translations/jv.po +16 -0
  153. package/lang/translations/km.po +16 -0
  154. package/lang/translations/kn.po +16 -0
  155. package/lang/translations/ko.po +16 -0
  156. package/lang/translations/ku.po +16 -0
  157. package/lang/translations/lt.po +16 -0
  158. package/lang/translations/lv.po +16 -0
  159. package/lang/translations/ms.po +16 -0
  160. package/lang/translations/nb.po +16 -0
  161. package/lang/translations/ne.po +16 -0
  162. package/lang/translations/nl.po +16 -0
  163. package/lang/translations/no.po +16 -0
  164. package/lang/translations/pl.po +16 -0
  165. package/lang/translations/pt-br.po +16 -0
  166. package/lang/translations/pt.po +27 -11
  167. package/lang/translations/ro.po +16 -0
  168. package/lang/translations/ru.po +16 -0
  169. package/lang/translations/si.po +16 -0
  170. package/lang/translations/sk.po +16 -0
  171. package/lang/translations/sq.po +16 -0
  172. package/lang/translations/sr-latn.po +16 -0
  173. package/lang/translations/sr.po +16 -0
  174. package/lang/translations/sv.po +16 -0
  175. package/lang/translations/th.po +16 -0
  176. package/lang/translations/tk.po +16 -0
  177. package/lang/translations/tr.po +16 -0
  178. package/lang/translations/tt.po +16 -0
  179. package/lang/translations/ug.po +16 -0
  180. package/lang/translations/uk.po +16 -0
  181. package/lang/translations/ur.po +16 -0
  182. package/lang/translations/uz.po +16 -0
  183. package/lang/translations/vi.po +16 -0
  184. package/lang/translations/zh-cn.po +16 -0
  185. package/lang/translations/zh.po +16 -0
  186. package/package.json +3 -2
  187. package/src/augmentation.d.ts +1 -1
  188. package/src/list/listediting.d.ts +4 -0
  189. package/src/list/listediting.js +22 -0
  190. package/src/listproperties/ui/listpropertiesview.js +3 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { List, ListEditing, ListUtils, ListUI, ListCommand, ListIndentCommand, ListMergeCommand, ListSplitCommand, ListProperties, ListPropertiesUtils, ListPropertiesEditing, ListPropertiesUI, ListStyleCommand, ListStartCommand, ListReversedCommand, TodoList, TodoListEditing, TodoListUI, CheckTodoListCommand, LegacyList, LegacyListEditing, LegacyListUtils, LegacyListCommand, LegacyIndentCommand, LegacyListProperties, LegacyListPropertiesEditing, LegacyListStyleCommand, LegacyListStartCommand, LegacyListReversedCommand, LegacyTodoList, LegacyTodoListEditing, LegacyCheckTodoListCommand, ListConfig, DocumentList, DocumentListProperties, TodoDocumentList } from './index.js';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of the {@link module:list/list~List} feature and the {@link module:list/legacylist~LegacyList} feature.
10
+ *
11
+ * Read more in {@link module:list/listconfig~ListConfig}.
12
+ */
13
+ list?: ListConfig;
14
+ }
15
+ interface PluginsMap {
16
+ [List.pluginName]: List;
17
+ [ListEditing.pluginName]: ListEditing;
18
+ [ListUtils.pluginName]: ListUtils;
19
+ [ListUI.pluginName]: ListUI;
20
+ [ListProperties.pluginName]: ListProperties;
21
+ [ListPropertiesEditing.pluginName]: ListPropertiesEditing;
22
+ [ListPropertiesUtils.pluginName]: ListPropertiesUtils;
23
+ [ListPropertiesUI.pluginName]: ListPropertiesUI;
24
+ [TodoList.pluginName]: TodoDocumentList;
25
+ [TodoListEditing.pluginName]: TodoListEditing;
26
+ [TodoListUI.pluginName]: TodoListUI;
27
+ [LegacyList.pluginName]: LegacyList;
28
+ [LegacyListEditing.pluginName]: LegacyListEditing;
29
+ [LegacyListUtils.pluginName]: LegacyListUtils;
30
+ [LegacyListProperties.pluginName]: LegacyListProperties;
31
+ [LegacyListPropertiesEditing.pluginName]: LegacyListPropertiesEditing;
32
+ [LegacyTodoList.pluginName]: LegacyTodoList;
33
+ [LegacyTodoListEditing.pluginName]: LegacyTodoListEditing;
34
+ [DocumentList.pluginName]: DocumentList;
35
+ [DocumentListProperties.pluginName]: DocumentListProperties;
36
+ [TodoDocumentList.pluginName]: TodoDocumentList;
37
+ }
38
+ interface CommandsMap {
39
+ numberedList: LegacyListCommand | ListCommand;
40
+ bulletedList: LegacyListCommand | ListCommand;
41
+ indentList: LegacyIndentCommand | ListIndentCommand;
42
+ outdentList: LegacyIndentCommand | ListIndentCommand;
43
+ mergeListItemBackward: ListMergeCommand;
44
+ mergeListItemForward: ListMergeCommand;
45
+ splitListItemBefore: ListSplitCommand;
46
+ splitListItemAfter: ListSplitCommand;
47
+ listStyle: LegacyListStyleCommand | ListStyleCommand;
48
+ listStart: LegacyListStartCommand | ListStartCommand;
49
+ listReversed: LegacyListReversedCommand | ListReversedCommand;
50
+ todoList: LegacyListCommand | ListCommand;
51
+ checkTodoList: LegacyCheckTodoListCommand | CheckTodoListCommand;
52
+ }
53
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/documentlist
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
+ import List from './list.js';
10
+ /**
11
+ * The document list feature.
12
+ *
13
+ * This is an obsolete plugin that exists for backward compatibility only.
14
+ * Use the {@link module:list/list~List `List`} instead.
15
+ *
16
+ * @deprecated
17
+ */
18
+ export default class DocumentList extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof List];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "DocumentList";
27
+ constructor(editor: Editor);
28
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/documentlistproperties
7
+ */
8
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
9
+ import ListProperties from './listproperties.js';
10
+ /**
11
+ * The document list properties feature.
12
+ *
13
+ * This is an obsolete plugin that exists for backward compatibility only.
14
+ * Use the {@link module:list/listproperties~ListProperties `ListProperties`} instead.
15
+ *
16
+ * @deprecated
17
+ */
18
+ export default class DocumentListProperties extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof ListProperties];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "DocumentListProperties";
27
+ constructor(editor: Editor);
28
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list
7
+ */
8
+ export { default as List } from './list.js';
9
+ export { default as ListEditing, type ListEditingPostFixerEvent } from './list/listediting.js';
10
+ export { default as ListUtils } from './list/listutils.js';
11
+ export { default as ListUI } from './list/listui.js';
12
+ export { default as ListIndentCommand } from './list/listindentcommand.js';
13
+ export type { default as ListCommand } from './list/listcommand.js';
14
+ export type { default as ListMergeCommand } from './list/listmergecommand.js';
15
+ export type { default as ListSplitCommand } from './list/listsplitcommand.js';
16
+ export { default as ListProperties } from './listproperties.js';
17
+ export { default as ListPropertiesEditing } from './listproperties/listpropertiesediting.js';
18
+ export { default as ListPropertiesUtils } from './listproperties/listpropertiesutils.js';
19
+ export { default as ListPropertiesUI } from './listproperties/listpropertiesui.js';
20
+ export type { default as ListReversedCommand } from './listproperties/listreversedcommand.js';
21
+ export type { default as ListStartCommand } from './listproperties/liststartcommand.js';
22
+ export type { default as ListStyleCommand } from './listproperties/liststylecommand.js';
23
+ export { default as TodoList } from './todolist.js';
24
+ export { default as TodoListUI } from './todolist/todolistui.js';
25
+ export { default as TodoListEditing } from './todolist/todolistediting.js';
26
+ export type { default as CheckTodoListCommand } from './todolist/checktodolistcommand.js';
27
+ export { default as LegacyList } from './legacylist.js';
28
+ export { default as LegacyListEditing } from './legacylist/legacylistediting.js';
29
+ export { default as LegacyListUtils } from './legacylist/legacylistutils.js';
30
+ export { default as LegacyIndentCommand } from './legacylist/legacyindentcommand.js';
31
+ export type { default as LegacyListCommand } from './legacylist/legacylistcommand.js';
32
+ export { default as LegacyListProperties } from './legacylistproperties.js';
33
+ export { default as LegacyListPropertiesEditing } from './legacylistproperties/legacylistpropertiesediting.js';
34
+ export type { default as LegacyListReversedCommand } from './legacylistproperties/legacylistreversedcommand.js';
35
+ export type { default as LegacyListStartCommand } from './legacylistproperties/legacyliststartcommand.js';
36
+ export type { default as LegacyListStyleCommand } from './legacylistproperties/legacyliststylecommand.js';
37
+ export { default as LegacyTodoList } from './legacytodolist.js';
38
+ export { default as LegacyTodoListEditing } from './legacytodolist/legacytodolistediting.js';
39
+ export type { default as LegacyCheckTodoListCommand } from './legacytodolist/legacychecktodolistcommand.js';
40
+ export type { ListConfig, ListPropertiesConfig } from './listconfig.js';
41
+ export { default as AdjacentListsSupport } from './list/adjacentlistssupport.js';
42
+ export { default as DocumentList } from './documentlist.js';
43
+ export { default as DocumentListProperties } from './documentlistproperties.js';
44
+ export { default as TodoDocumentList } from './tododocumentlist.js';
45
+ import './augmentation.js';
@@ -0,0 +1,196 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/legacylist/legacyconverters
7
+ */
8
+ import { type DowncastAttributeEvent, type DowncastInsertEvent, type DowncastRemoveEvent, type Element, type MapperModelToViewPositionEvent, type MapperViewToModelPositionEvent, type Model, type ModelInsertContentEvent, type UpcastElementEvent, type EditingView, type Writer } from 'ckeditor5/src/engine.js';
9
+ import type { GetCallback } from 'ckeditor5/src/utils.js';
10
+ /**
11
+ * A model-to-view converter for the `listItem` model element insertion.
12
+ *
13
+ * It creates a `<ul><li></li><ul>` (or `<ol>`) view structure out of a `listItem` model element, inserts it at the correct
14
+ * position, and merges the list with surrounding lists (if available).
15
+ *
16
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
17
+ * @param model Model instance.
18
+ */
19
+ export declare function modelViewInsertion(model: Model): GetCallback<DowncastInsertEvent<Element>>;
20
+ /**
21
+ * A model-to-view converter for the `listItem` model element removal.
22
+ *
23
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove
24
+ * @param model Model instance.
25
+ * @returns Returns a conversion callback.
26
+ */
27
+ export declare function modelViewRemove(model: Model): GetCallback<DowncastRemoveEvent>;
28
+ /**
29
+ * A model-to-view converter for the `type` attribute change on the `listItem` model element.
30
+ *
31
+ * This change means that the `<li>` element parent changes from `<ul>` to `<ol>` (or vice versa). This is accomplished
32
+ * by breaking view elements and changing their name. The next {@link module:list/legacylist/legacyconverters~modelViewMergeAfterChangeType}
33
+ * converter will attempt to merge split nodes.
34
+ *
35
+ * Splitting this conversion into 2 steps makes it possible to add an additional conversion in the middle.
36
+ * Check {@link module:list/legacytodolist/legacytodolistconverters~modelViewChangeType} to see an example of it.
37
+ *
38
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
39
+ */
40
+ export declare const modelViewChangeType: GetCallback<DowncastAttributeEvent<Element>>;
41
+ /**
42
+ * A model-to-view converter that attempts to merge nodes split by {@link module:list/legacylist/legacyconverters~modelViewChangeType}.
43
+ *
44
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
45
+ */
46
+ export declare const modelViewMergeAfterChangeType: GetCallback<DowncastAttributeEvent<Element>>;
47
+ /**
48
+ * A model-to-view converter for the `listIndent` attribute change on the `listItem` model element.
49
+ *
50
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:attribute
51
+ * @param model Model instance.
52
+ * @returns Returns a conversion callback.
53
+ */
54
+ export declare function modelViewChangeIndent(model: Model): GetCallback<DowncastAttributeEvent<Element>>;
55
+ /**
56
+ * A special model-to-view converter introduced by the {@link module:list/legacylist~LegacyList list feature}. This converter is fired for
57
+ * insert change of every model item, and should be fired before the actual converter. The converter checks whether the inserted
58
+ * model item is a non-`listItem` element. If it is, and it is inserted inside a view list, the converter breaks the
59
+ * list so the model element is inserted to the view parent element corresponding to its model parent element.
60
+ *
61
+ * The converter prevents such situations:
62
+ *
63
+ * ```xml
64
+ * // Model: // View:
65
+ * <listItem>foo</listItem> <ul>
66
+ * <listItem>bar</listItem> <li>foo</li>
67
+ * <li>bar</li>
68
+ * </ul>
69
+ *
70
+ * // After change: // Correct view guaranteed by this converter:
71
+ * <listItem>foo</listItem> <ul><li>foo</li></ul><p>xxx</p><ul><li>bar</li></ul>
72
+ * <paragraph>xxx</paragraph> // Instead of this wrong view state:
73
+ * <listItem>bar</listItem> <ul><li>foo</li><p>xxx</p><li>bar</li></ul>
74
+ * ```
75
+ *
76
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:insert
77
+ */
78
+ export declare const modelViewSplitOnInsert: GetCallback<DowncastInsertEvent<Element>>;
79
+ /**
80
+ * A special model-to-view converter introduced by the {@link module:list/legacylist~LegacyList list feature}. This converter takes care of
81
+ * merging view lists after something is removed or moved from near them.
82
+ *
83
+ * Example:
84
+ *
85
+ * ```xml
86
+ * // Model: // View:
87
+ * <listItem>foo</listItem> <ul><li>foo</li></ul>
88
+ * <paragraph>xxx</paragraph> <p>xxx</p>
89
+ * <listItem>bar</listItem> <ul><li>bar</li></ul>
90
+ *
91
+ * // After change: // Correct view guaranteed by this converter:
92
+ * <listItem>foo</listItem> <ul>
93
+ * <listItem>bar</listItem> <li>foo</li>
94
+ * <li>bar</li>
95
+ * </ul>
96
+ * ```
97
+ *
98
+ * @see module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:remove
99
+ */
100
+ export declare const modelViewMergeAfter: GetCallback<DowncastRemoveEvent>;
101
+ /**
102
+ * A view-to-model converter that converts the `<li>` view elements into the `listItem` model elements.
103
+ *
104
+ * To set correct values of the `listType` and `listIndent` attributes the converter:
105
+ * * checks `<li>`'s parent,
106
+ * * stores and increases the `conversionApi.store.indent` value when `<li>`'s sub-items are converted.
107
+ *
108
+ * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
109
+ */
110
+ export declare const viewModelConverter: GetCallback<UpcastElementEvent>;
111
+ /**
112
+ * A view-to-model converter for the `<ul>` and `<ol>` view elements that cleans the input view of garbage.
113
+ * This is mostly to clean whitespaces from between the `<li>` view elements inside the view list element, however, also
114
+ * incorrect data can be cleared if the view was incorrect.
115
+ *
116
+ * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
117
+ */
118
+ export declare const cleanList: GetCallback<UpcastElementEvent>;
119
+ /**
120
+ * A view-to-model converter for the `<li>` elements that cleans whitespace formatting from the input view.
121
+ *
122
+ * @see module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element
123
+ */
124
+ export declare const cleanListItem: GetCallback<UpcastElementEvent>;
125
+ /**
126
+ * Returns a callback for model position to view position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
127
+ * positions between the `listItem` elements that would be incorrectly mapped because of how list items are represented in the model
128
+ * and in the view.
129
+ */
130
+ export declare function modelToViewPosition(view: EditingView): GetCallback<MapperModelToViewPositionEvent>;
131
+ /**
132
+ * The callback for view position to model position mapping for {@link module:engine/conversion/mapper~Mapper}. The callback fixes
133
+ * positions between the `<li>` elements that would be incorrectly mapped because of how list items are represented in the model
134
+ * and in the view.
135
+ *
136
+ * @see module:engine/conversion/mapper~Mapper#event:viewToModelPosition
137
+ * @param model Model instance.
138
+ * @returns Returns a conversion callback.
139
+ */
140
+ export declare function viewToModelPosition(model: Model): GetCallback<MapperViewToModelPositionEvent>;
141
+ /**
142
+ * Post-fixer that reacts to changes on document and fixes incorrect model states.
143
+ *
144
+ * In the example below, there is a correct list structure.
145
+ * Then the middle element is removed so the list structure will become incorrect:
146
+ *
147
+ * ```xml
148
+ * <listItem listType="bulleted" listIndent=0>Item 1</listItem>
149
+ * <listItem listType="bulleted" listIndent=1>Item 2</listItem> <--- this is removed.
150
+ * <listItem listType="bulleted" listIndent=2>Item 3</listItem>
151
+ * ```
152
+ *
153
+ * The list structure after the middle element is removed:
154
+ *
155
+ * ```xml
156
+ * <listItem listType="bulleted" listIndent=0>Item 1</listItem>
157
+ * <listItem listType="bulleted" listIndent=2>Item 3</listItem>
158
+ * ```
159
+ *
160
+ * Should become:
161
+ *
162
+ * ```xml
163
+ * <listItem listType="bulleted" listIndent=0>Item 1</listItem>
164
+ * <listItem listType="bulleted" listIndent=1>Item 3</listItem> <--- note that indent got post-fixed.
165
+ * ```
166
+ *
167
+ * @param model The data model.
168
+ * @param writer The writer to do changes with.
169
+ * @returns `true` if any change has been applied, `false` otherwise.
170
+ */
171
+ export declare function modelChangePostFixer(model: Model, writer: Writer): boolean;
172
+ /**
173
+ * A fixer for pasted content that includes list items.
174
+ *
175
+ * It fixes indentation of pasted list items so the pasted items match correctly to the context they are pasted into.
176
+ *
177
+ * Example:
178
+ *
179
+ * ```xml
180
+ * <listItem listType="bulleted" listIndent=0>A</listItem>
181
+ * <listItem listType="bulleted" listIndent=1>B^</listItem>
182
+ * // At ^ paste: <listItem listType="bulleted" listIndent=4>X</listItem>
183
+ * // <listItem listType="bulleted" listIndent=5>Y</listItem>
184
+ * <listItem listType="bulleted" listIndent=2>C</listItem>
185
+ * ```
186
+ *
187
+ * Should become:
188
+ *
189
+ * ```xml
190
+ * <listItem listType="bulleted" listIndent=0>A</listItem>
191
+ * <listItem listType="bulleted" listIndent=1>BX</listItem>
192
+ * <listItem listType="bulleted" listIndent=2>Y/listItem>
193
+ * <listItem listType="bulleted" listIndent=2>C</listItem>
194
+ * ```
195
+ */
196
+ export declare const modelIndentPasteFixer: GetCallback<ModelInsertContentEvent>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
6
+ /**
7
+ * The list indent command. It is used by the {@link module:list/legacylist~LegacyList legacy list feature}.
8
+ */
9
+ export default class LegacyIndentCommand extends Command {
10
+ /**
11
+ * Determines by how much the command will change the list item's indent attribute.
12
+ */
13
+ private readonly _indentBy;
14
+ /**
15
+ * Creates an instance of the command.
16
+ *
17
+ * @param editor The editor instance.
18
+ * @param indentDirection The direction of indent. If it is equal to `backward`, the command will outdent a list item.
19
+ */
20
+ constructor(editor: Editor, indentDirection: 'forward' | 'backward');
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ refresh(): void;
25
+ /**
26
+ * Indents or outdents (depending on the {@link #constructor}'s `indentDirection` parameter) selected list items.
27
+ *
28
+ * @fires execute
29
+ */
30
+ execute(): void;
31
+ /**
32
+ * Checks whether the command can be enabled in the current context.
33
+ *
34
+ * @returns Whether the command should be enabled.
35
+ */
36
+ private _checkEnabled;
37
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
6
+ /**
7
+ * The list command. It is used by the {@link module:list/legacylist~LegacyList legacy list feature}.
8
+ */
9
+ export default class LegacyListCommand extends Command {
10
+ /**
11
+ * The type of the list created by the command.
12
+ */
13
+ readonly type: 'numbered' | 'bulleted' | 'todo';
14
+ /**
15
+ * A flag indicating whether the command is active, which means that the selection starts in a list of the same type.
16
+ *
17
+ * @readonly
18
+ */
19
+ value: boolean;
20
+ /**
21
+ * Creates an instance of the command.
22
+ *
23
+ * @param editor The editor instance.
24
+ * @param type List type that will be handled by this command.
25
+ */
26
+ constructor(editor: Editor, type: 'numbered' | 'bulleted' | 'todo');
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ refresh(): void;
31
+ /**
32
+ * Executes the list command.
33
+ *
34
+ * @fires execute
35
+ * @param options Command options.
36
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will try to convert the
37
+ * selected items and potentially the neighbor elements to the proper list items. If set to `false`, it will convert selected elements
38
+ * to paragraphs. If not set, the command will toggle selected elements to list items or paragraphs, depending on the selection.
39
+ */
40
+ execute(options?: {
41
+ forceValue?: boolean;
42
+ }): void;
43
+ /**
44
+ * Checks the command's {@link #value}.
45
+ *
46
+ * @returns The current value.
47
+ */
48
+ private _getValue;
49
+ /**
50
+ * Checks whether the command can be enabled in the current context.
51
+ *
52
+ * @returns Whether the command should be enabled.
53
+ */
54
+ private _checkEnabled;
55
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import LegacyListUtils from './legacylistutils.js';
6
+ import { Plugin } from 'ckeditor5/src/core.js';
7
+ import { Enter } from 'ckeditor5/src/enter.js';
8
+ import { Delete } from 'ckeditor5/src/typing.js';
9
+ import '../../theme/list.css';
10
+ /**
11
+ * The engine of the list feature. It handles creating, editing and removing lists and list items.
12
+ *
13
+ * It registers the `'numberedList'`, `'bulletedList'`, `'indentList'` and `'outdentList'` commands.
14
+ */
15
+ export default class LegacyListEditing extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName(): "LegacyListEditing";
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires(): readonly [typeof Enter, typeof Delete, typeof LegacyListUtils];
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ init(): void;
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ afterInit(): void;
32
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/legacylist/legacylistutils
7
+ */
8
+ import type { Element, Model, Position } from 'ckeditor5/src/engine.js';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ /**
11
+ * A set of helpers related to legacy lists.
12
+ */
13
+ export default class LegacyListUtils extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "LegacyListUtils";
18
+ /**
19
+ * Checks whether the given list-style-type is supported by numbered or bulleted list.
20
+ */
21
+ getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
22
+ /**
23
+ * Returns an array with all `listItem` elements in the model selection.
24
+ *
25
+ * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
26
+ * If no list is selected, it returns an empty array.
27
+ * The order of the elements is not specified.
28
+ */
29
+ getSelectedListItems(model: Model): Array<Element>;
30
+ /**
31
+ * Returns an array with all `listItem` elements that represent the same list.
32
+ *
33
+ * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
34
+ *
35
+ * Additionally, if the `position` is inside a list item, that list item will be returned as well.
36
+ *
37
+ * @param position Starting position.
38
+ * @param direction Walking direction.
39
+ */
40
+ getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
41
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/legacylist/legacyutils
7
+ */
8
+ import { type DowncastConversionApi, type DowncastWriter, type Element, type Item, type Model, type Position, type ViewContainerElement, type ViewElement, type ViewItem, type ViewPosition } from 'ckeditor5/src/engine.js';
9
+ /**
10
+ * Creates a list item {@link module:engine/view/containerelement~ContainerElement}.
11
+ *
12
+ * @param writer The writer instance.
13
+ */
14
+ export declare function createViewListItemElement(writer: DowncastWriter): ViewContainerElement;
15
+ /**
16
+ * Helper function that creates a `<ul><li></li></ul>` or (`<ol>`) structure out of the given `modelItem` model `listItem` element.
17
+ * Then, it binds the created view list item (`<li>`) with the model `listItem` element.
18
+ * The function then returns the created view list item (`<li>`).
19
+ *
20
+ * @param modelItem Model list item.
21
+ * @param conversionApi Conversion interface.
22
+ * @returns View list element.
23
+ */
24
+ export declare function generateLiInUl(modelItem: Item, conversionApi: DowncastConversionApi): ViewContainerElement;
25
+ /**
26
+ * Helper function that inserts a view list at a correct place and merges it with its siblings.
27
+ * It takes a model list item element (`modelItem`) and a corresponding view list item element (`injectedItem`). The view list item
28
+ * should be in a view list element (`<ul>` or `<ol>`) and should be its only child.
29
+ * See comments below to better understand the algorithm.
30
+ *
31
+ * @param modelItem Model list item.
32
+ * @param injectedItem
33
+ * @param conversionApi Conversion interface.
34
+ * @param model The model instance.
35
+ */
36
+ export declare function injectViewList(modelItem: Element, injectedItem: ViewContainerElement, conversionApi: DowncastConversionApi, model: Model): void;
37
+ /**
38
+ * Helper function that takes two parameters that are expected to be view list elements, and merges them.
39
+ * The merge happens only if both parameters are list elements of the same type (the same element name and the same class attributes).
40
+ *
41
+ * @param viewWriter The writer instance.
42
+ * @param firstList The first element to compare.
43
+ * @param secondList The second element to compare.
44
+ * @returns The position after merge or `null` when there was no merge.
45
+ */
46
+ export declare function mergeViewLists(viewWriter: DowncastWriter, firstList: ViewItem, secondList: ViewItem): ViewPosition | null;
47
+ /**
48
+ * Helper function that for a given `view.Position`, returns a `view.Position` that is after all `view.UIElement`s that
49
+ * are after the given position.
50
+ *
51
+ * For example:
52
+ * `<container:p>foo^<ui:span></ui:span><ui:span></ui:span>bar</container:p>`
53
+ * For position ^, the position before "bar" will be returned.
54
+ *
55
+ */
56
+ export declare function positionAfterUiElements(viewPosition: ViewPosition): ViewPosition;
57
+ /**
58
+ * Helper function that searches for a previous list item sibling of a given model item that meets the given criteria
59
+ * passed by the options object.
60
+ *
61
+ * @param options Search criteria.
62
+ * @param options.sameIndent Whether the sought sibling should have the same indentation.
63
+ * @param options.smallerIndent Whether the sought sibling should have a smaller indentation.
64
+ * @param options.listIndent The reference indentation.
65
+ * @param options.direction Walking direction.
66
+ */
67
+ export declare function getSiblingListItem(modelItem: Item | null, options: {
68
+ sameIndent?: boolean;
69
+ smallerIndent?: boolean;
70
+ listIndent?: number;
71
+ direction?: 'forward' | 'backward';
72
+ }): Element | null;
73
+ /**
74
+ * Returns a first list view element that is direct child of the given view element.
75
+ */
76
+ export declare function findNestedList(viewElement: ViewElement): ViewElement | null;
77
+ /**
78
+ * Returns an array with all `listItem` elements that represent the same list.
79
+ *
80
+ * It means that values of `listIndent`, `listType`, `listStyle`, `listReversed` and `listStart` for all items are equal.
81
+ *
82
+ * Additionally, if the `position` is inside a list item, that list item will be returned as well.
83
+ *
84
+ * @param position Starting position.
85
+ * @param direction Walking direction.
86
+ */
87
+ export declare function getSiblingNodes(position: Position, direction: 'forward' | 'backward'): Array<Element>;
88
+ /**
89
+ * Returns an array with all `listItem` elements in the model selection.
90
+ *
91
+ * It returns all the items even if only a part of the list is selected, including items that belong to nested lists.
92
+ * If no list is selected, it returns an empty array.
93
+ * The order of the elements is not specified.
94
+ *
95
+ * @internal
96
+ */
97
+ export declare function getSelectedListItems(model: Model): Array<Element>;
98
+ /**
99
+ * Checks whether the given list-style-type is supported by numbered or bulleted list.
100
+ */
101
+ export declare function getListTypeFromListStyleType(listStyleType: string): 'bulleted' | 'numbered' | null;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module list/legacylist
7
+ */
8
+ import LegacyListEditing from './legacylist/legacylistediting.js';
9
+ import ListUI from './list/listui.js';
10
+ import { Plugin } from 'ckeditor5/src/core.js';
11
+ /**
12
+ * The legacy list feature.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:list/legacylist/legacylistediting~LegacyListEditing legacy list editing feature}
15
+ * and {@link module:list/list/listui~ListUI list UI feature}.
16
+ */
17
+ export default class LegacyList extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires(): readonly [typeof LegacyListEditing, typeof ListUI];
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "LegacyList";
26
+ }