@ckeditor/ckeditor5-list 45.2.1 → 46.0.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 (122) hide show
  1. package/build/list.js +1 -1
  2. package/dist/index-content.css +50 -8
  3. package/dist/index-editor.css +14 -8
  4. package/dist/index.css +62 -15
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.js +736 -135
  7. package/dist/index.js.map +1 -1
  8. package/package.json +11 -10
  9. package/src/augmentation.d.ts +8 -5
  10. package/src/index.d.ts +61 -37
  11. package/src/index.js +53 -25
  12. package/src/legacyerrors.d.ts +5 -0
  13. package/src/legacyerrors.js +28 -0
  14. package/src/legacylist/legacyconverters.d.ts +23 -7
  15. package/src/legacylist/legacyconverters.js +18 -2
  16. package/src/legacylist/legacyindentcommand.d.ts +1 -1
  17. package/src/legacylist/legacyindentcommand.js +1 -1
  18. package/src/legacylist/legacylistcommand.d.ts +1 -1
  19. package/src/legacylist/legacylistcommand.js +1 -1
  20. package/src/legacylist/legacylistediting.d.ts +2 -2
  21. package/src/legacylist/legacylistediting.js +4 -4
  22. package/src/legacylist/legacylistutils.d.ts +4 -4
  23. package/src/legacylist/legacylistutils.js +1 -1
  24. package/src/legacylist/legacyutils.d.ts +21 -10
  25. package/src/legacylist/legacyutils.js +14 -4
  26. package/src/legacylist.d.ts +3 -3
  27. package/src/legacylist.js +3 -3
  28. package/src/legacylistproperties/legacylistpropertiesediting.d.ts +2 -2
  29. package/src/legacylistproperties/legacylistpropertiesediting.js +5 -5
  30. package/src/legacylistproperties/legacylistreversedcommand.d.ts +1 -1
  31. package/src/legacylistproperties/legacylistreversedcommand.js +1 -1
  32. package/src/legacylistproperties/legacyliststartcommand.d.ts +1 -1
  33. package/src/legacylistproperties/legacyliststartcommand.js +1 -1
  34. package/src/legacylistproperties/legacyliststylecommand.d.ts +1 -1
  35. package/src/legacylistproperties/legacyliststylecommand.js +1 -1
  36. package/src/legacylistproperties.d.ts +3 -3
  37. package/src/legacylistproperties.js +3 -3
  38. package/src/legacytodolist/legacychecktodolistcommand.d.ts +6 -6
  39. package/src/legacytodolist/legacychecktodolistcommand.js +3 -3
  40. package/src/legacytodolist/legacytodolistconverters.d.ts +15 -8
  41. package/src/legacytodolist/legacytodolistconverters.js +10 -3
  42. package/src/legacytodolist/legacytodolistediting.d.ts +2 -2
  43. package/src/legacytodolist/legacytodolistediting.js +4 -4
  44. package/src/legacytodolist.d.ts +3 -3
  45. package/src/legacytodolist.js +3 -3
  46. package/src/list/adjacentlistssupport.d.ts +1 -1
  47. package/src/list/adjacentlistssupport.js +1 -1
  48. package/src/list/converters.d.ts +9 -5
  49. package/src/list/converters.js +12 -7
  50. package/src/list/listcommand.d.ts +3 -3
  51. package/src/list/listcommand.js +1 -1
  52. package/src/list/listediting.d.ts +21 -17
  53. package/src/list/listediting.js +28 -11
  54. package/src/list/listindentcommand.d.ts +3 -3
  55. package/src/list/listindentcommand.js +2 -2
  56. package/src/list/listmergecommand.d.ts +3 -3
  57. package/src/list/listmergecommand.js +2 -2
  58. package/src/list/listsplitcommand.d.ts +3 -3
  59. package/src/list/listsplitcommand.js +1 -1
  60. package/src/list/listui.d.ts +1 -1
  61. package/src/list/listui.js +1 -1
  62. package/src/list/listutils.d.ts +7 -7
  63. package/src/list/listutils.js +1 -1
  64. package/src/list/utils/listwalker.d.ts +12 -6
  65. package/src/list/utils/listwalker.js +5 -1
  66. package/src/list/utils/model.d.ts +25 -22
  67. package/src/list/utils/model.js +7 -2
  68. package/src/list/utils/postfixers.d.ts +4 -4
  69. package/src/list/utils/view.d.ts +3 -3
  70. package/src/list.d.ts +3 -3
  71. package/src/list.js +3 -3
  72. package/src/listconfig.d.ts +13 -0
  73. package/src/listformatting/listitemboldintegration.d.ts +34 -0
  74. package/src/listformatting/listitemboldintegration.js +83 -0
  75. package/src/listformatting/listitemfontcolorintegration.d.ts +34 -0
  76. package/src/listformatting/listitemfontcolorintegration.js +92 -0
  77. package/src/listformatting/listitemfontfamilyintegration.d.ts +34 -0
  78. package/src/listformatting/listitemfontfamilyintegration.js +93 -0
  79. package/src/listformatting/listitemfontsizeintegration.d.ts +34 -0
  80. package/src/listformatting/listitemfontsizeintegration.js +119 -0
  81. package/src/listformatting/listitemitalicintegration.d.ts +34 -0
  82. package/src/listformatting/listitemitalicintegration.js +83 -0
  83. package/src/listformatting.d.ts +71 -0
  84. package/src/listformatting.js +243 -0
  85. package/src/listproperties/listpropertiesediting.d.ts +7 -7
  86. package/src/listproperties/listpropertiesediting.js +6 -6
  87. package/src/listproperties/listpropertiesui.d.ts +1 -1
  88. package/src/listproperties/listpropertiesui.js +2 -2
  89. package/src/listproperties/listpropertiesutils.d.ts +1 -1
  90. package/src/listproperties/listpropertiesutils.js +1 -1
  91. package/src/listproperties/listreversedcommand.d.ts +1 -1
  92. package/src/listproperties/listreversedcommand.js +1 -1
  93. package/src/listproperties/liststartcommand.d.ts +1 -1
  94. package/src/listproperties/liststartcommand.js +1 -1
  95. package/src/listproperties/liststylecommand.d.ts +1 -1
  96. package/src/listproperties/liststylecommand.js +1 -1
  97. package/src/listproperties/ui/listpropertiesview.d.ts +6 -1
  98. package/src/listproperties/ui/listpropertiesview.js +1 -1
  99. package/src/listproperties/utils/config.d.ts +3 -0
  100. package/src/listproperties/utils/config.js +1 -0
  101. package/src/listproperties/utils/style.d.ts +9 -0
  102. package/src/listproperties/utils/style.js +9 -0
  103. package/src/listproperties.d.ts +3 -3
  104. package/src/listproperties.js +3 -3
  105. package/src/todolist/checktodolistcommand.d.ts +3 -3
  106. package/src/todolist/checktodolistcommand.js +2 -2
  107. package/src/todolist/todocheckboxchangeobserver.d.ts +8 -6
  108. package/src/todolist/todocheckboxchangeobserver.js +4 -2
  109. package/src/todolist/todolistediting.d.ts +2 -2
  110. package/src/todolist/todolistediting.js +5 -5
  111. package/src/todolist/todolistui.d.ts +1 -1
  112. package/src/todolist/todolistui.js +1 -1
  113. package/src/todolist.d.ts +3 -3
  114. package/src/todolist.js +3 -3
  115. package/theme/listformatting.css +48 -0
  116. package/theme/todolist.css +8 -8
  117. package/src/documentlist.d.ts +0 -32
  118. package/src/documentlist.js +0 -47
  119. package/src/documentlistproperties.d.ts +0 -32
  120. package/src/documentlistproperties.js +0 -47
  121. package/src/tododocumentlist.d.ts +0 -32
  122. package/src/tododocumentlist.js +0 -47
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontcolorintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item font color integration plugin.
12
+ */
13
+ export declare class ListItemFontColorIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "ListItemFontColorIntegration";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get isOfficialPlugin(): true;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): readonly [typeof ListEditing];
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ afterInit(): void;
34
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontcolorintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item font color integration plugin.
12
+ */
13
+ export class ListItemFontColorIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName() {
18
+ return 'ListItemFontColorIntegration';
19
+ }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get isOfficialPlugin() {
24
+ return true;
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [ListEditing];
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init() {
36
+ const editor = this.editor;
37
+ const ListFormatting = editor.plugins.get('ListFormatting');
38
+ const listEditing = editor.plugins.get(ListEditing);
39
+ if (!editor.plugins.has('FontColorEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
40
+ return;
41
+ }
42
+ ListFormatting.registerFormatAttribute('fontColor', 'listItemFontColor');
43
+ // Register the downcast strategy in init() so that the attribute name is registered before the list editing
44
+ // registers its converters.
45
+ // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.
46
+ listEditing.registerDowncastStrategy({
47
+ scope: 'item',
48
+ attributeName: 'listItemFontColor',
49
+ setAttributeOnDowncast(writer, value, viewElement) {
50
+ if (value) {
51
+ writer.addClass('ck-list-marker-color', viewElement);
52
+ writer.setStyle('--ck-content-list-marker-color', value, viewElement);
53
+ }
54
+ }
55
+ });
56
+ }
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ afterInit() {
61
+ const editor = this.editor;
62
+ const model = editor.model;
63
+ if (!editor.plugins.has('FontColorEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
64
+ return;
65
+ }
66
+ model.schema.extend('$listItem', { allowAttributes: 'listItemFontColor' });
67
+ model.schema.setAttributeProperties('listItemFontColor', {
68
+ isFormatting: true
69
+ });
70
+ model.schema.addAttributeCheck(context => {
71
+ const item = context.last;
72
+ if (!item.getAttribute('listItemId')) {
73
+ return false;
74
+ }
75
+ }, 'listItemFontColor');
76
+ editor.conversion.for('upcast').attributeToAttribute({
77
+ model: {
78
+ key: 'listItemFontColor',
79
+ value: (viewElement) => {
80
+ return viewElement.getStyle('--ck-content-list-marker-color');
81
+ }
82
+ },
83
+ view: {
84
+ name: 'li',
85
+ classes: 'ck-list-marker-color',
86
+ styles: {
87
+ '--ck-content-list-marker-color': /.*/
88
+ }
89
+ }
90
+ });
91
+ }
92
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontfamilyintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item font family integration plugin.
12
+ */
13
+ export declare class ListItemFontFamilyIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "ListItemFontFamilyIntegration";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get isOfficialPlugin(): true;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): readonly [typeof ListEditing];
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ afterInit(): void;
34
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontfamilyintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item font family integration plugin.
12
+ */
13
+ export class ListItemFontFamilyIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName() {
18
+ return 'ListItemFontFamilyIntegration';
19
+ }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get isOfficialPlugin() {
24
+ return true;
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [ListEditing];
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init() {
36
+ const editor = this.editor;
37
+ const ListFormatting = editor.plugins.get('ListFormatting');
38
+ const listEditing = editor.plugins.get(ListEditing);
39
+ if (!editor.plugins.has('FontFamilyEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
40
+ return;
41
+ }
42
+ ListFormatting.registerFormatAttribute('fontFamily', 'listItemFontFamily');
43
+ // Register the downcast strategy in init() so that the attribute name is registered before the list editing
44
+ // registers its converters.
45
+ // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.
46
+ listEditing.registerDowncastStrategy({
47
+ scope: 'item',
48
+ attributeName: 'listItemFontFamily',
49
+ setAttributeOnDowncast(writer, value, viewElement) {
50
+ // There is no need of removing the style because downcast strategies handles it automatically.
51
+ if (value) {
52
+ writer.addClass('ck-list-marker-font-family', viewElement);
53
+ writer.setStyle('--ck-content-list-marker-font-family', value, viewElement);
54
+ }
55
+ }
56
+ });
57
+ }
58
+ /**
59
+ * @inheritDoc
60
+ */
61
+ afterInit() {
62
+ const editor = this.editor;
63
+ const model = editor.model;
64
+ if (!editor.plugins.has('FontFamilyEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
65
+ return;
66
+ }
67
+ model.schema.extend('$listItem', { allowAttributes: 'listItemFontFamily' });
68
+ model.schema.setAttributeProperties('listItemFontFamily', {
69
+ isFormatting: true
70
+ });
71
+ model.schema.addAttributeCheck(context => {
72
+ const item = context.last;
73
+ if (!item.getAttribute('listItemId')) {
74
+ return false;
75
+ }
76
+ }, 'listItemFontFamily');
77
+ editor.conversion.for('upcast').attributeToAttribute({
78
+ model: {
79
+ key: 'listItemFontFamily',
80
+ value: (viewElement) => {
81
+ return viewElement.getStyle('--ck-content-list-marker-font-family');
82
+ }
83
+ },
84
+ view: {
85
+ name: 'li',
86
+ classes: 'ck-list-marker-font-family',
87
+ styles: {
88
+ '--ck-content-list-marker-font-family': /.*/
89
+ }
90
+ }
91
+ });
92
+ }
93
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontsizeintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item font size integration plugin.
12
+ */
13
+ export declare class ListItemFontSizeIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "ListItemFontSizeIntegration";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get isOfficialPlugin(): true;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): readonly [typeof ListEditing];
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ afterInit(): void;
34
+ }
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemfontsizeintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { _normalizeFontSizeOptions } from '@ckeditor/ckeditor5-font';
10
+ import { ListEditing } from '../list/listediting.js';
11
+ /**
12
+ * The list item font size integration plugin.
13
+ */
14
+ export class ListItemFontSizeIntegration extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName() {
19
+ return 'ListItemFontSizeIntegration';
20
+ }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get isOfficialPlugin() {
25
+ return true;
26
+ }
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get requires() {
31
+ return [ListEditing];
32
+ }
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ init() {
37
+ const editor = this.editor;
38
+ const ListFormatting = editor.plugins.get('ListFormatting');
39
+ const listEditing = editor.plugins.get(ListEditing);
40
+ if (!editor.plugins.has('FontSizeEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
41
+ return;
42
+ }
43
+ const normalizedFontSizeOptions = _normalizeFontSizeOptions(editor.config.get('fontSize.options'));
44
+ ListFormatting.registerFormatAttribute('fontSize', 'listItemFontSize');
45
+ // Register the downcast strategy in init() so that the attribute name is registered before the list editing
46
+ // registers its converters.
47
+ // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.
48
+ listEditing.registerDowncastStrategy({
49
+ scope: 'item',
50
+ attributeName: 'listItemFontSize',
51
+ setAttributeOnDowncast(writer, value, viewElement) {
52
+ if (value) {
53
+ const fontSizeOption = normalizedFontSizeOptions.find(option => option.model == value);
54
+ if (fontSizeOption && fontSizeOption.view && typeof fontSizeOption.view != 'string') {
55
+ if (fontSizeOption.view.styles) {
56
+ writer.addClass('ck-list-marker-font-size', viewElement);
57
+ writer.setStyle('--ck-content-list-marker-font-size', fontSizeOption.view.styles['font-size'], viewElement);
58
+ }
59
+ else if (fontSizeOption.view.classes) {
60
+ writer.addClass(`ck-list-marker-font-size-${value}`, viewElement);
61
+ }
62
+ }
63
+ else {
64
+ writer.addClass('ck-list-marker-font-size', viewElement);
65
+ writer.setStyle('--ck-content-list-marker-font-size', value, viewElement);
66
+ }
67
+ }
68
+ }
69
+ });
70
+ }
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ afterInit() {
75
+ const editor = this.editor;
76
+ const model = editor.model;
77
+ if (!editor.plugins.has('FontSizeEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
78
+ return;
79
+ }
80
+ model.schema.extend('$listItem', { allowAttributes: 'listItemFontSize' });
81
+ model.schema.setAttributeProperties('listItemFontSize', {
82
+ isFormatting: true
83
+ });
84
+ model.schema.addAttributeCheck(context => {
85
+ const item = context.last;
86
+ if (!item.getAttribute('listItemId')) {
87
+ return false;
88
+ }
89
+ }, 'listItemFontSize');
90
+ editor.conversion.for('upcast').elementToAttribute({
91
+ model: {
92
+ key: 'listItemFontSize',
93
+ value: (viewElement) => viewElement.getStyle('--ck-content-list-marker-font-size')
94
+ },
95
+ view: {
96
+ name: 'li',
97
+ classes: 'ck-list-marker-font-size',
98
+ styles: {
99
+ '--ck-content-list-marker-font-size': /.*/
100
+ }
101
+ }
102
+ });
103
+ const fontSizeOptions = _normalizeFontSizeOptions(editor.config.get('fontSize.options'));
104
+ for (const option of fontSizeOptions) {
105
+ if (option.model && option.view) {
106
+ editor.conversion.for('upcast').elementToAttribute({
107
+ model: {
108
+ key: 'listItemFontSize',
109
+ value: option.model
110
+ },
111
+ view: {
112
+ name: 'li',
113
+ classes: `ck-list-marker-font-size-${option.model}`
114
+ }
115
+ });
116
+ }
117
+ }
118
+ }
119
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemitalicintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item italic integration plugin.
12
+ */
13
+ export declare class ListItemItalicIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "ListItemItalicIntegration";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get isOfficialPlugin(): true;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): readonly [typeof ListEditing];
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ afterInit(): void;
34
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting/listitemitalicintegration
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListEditing } from '../list/listediting.js';
10
+ /**
11
+ * The list item italic integration plugin.
12
+ */
13
+ export class ListItemItalicIntegration extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName() {
18
+ return 'ListItemItalicIntegration';
19
+ }
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get isOfficialPlugin() {
24
+ return true;
25
+ }
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires() {
30
+ return [ListEditing];
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init() {
36
+ const editor = this.editor;
37
+ const ListFormatting = editor.plugins.get('ListFormatting');
38
+ const listEditing = editor.plugins.get(ListEditing);
39
+ if (!editor.plugins.has('ItalicEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
40
+ return;
41
+ }
42
+ ListFormatting.registerFormatAttribute('italic', 'listItemItalic');
43
+ // Register the downcast strategy in init() so that the attribute name is registered before the list editing
44
+ // registers its converters.
45
+ // This ensures that the attribute is recognized by downcast strategies and bogus paragraphs are handled correctly.
46
+ listEditing.registerDowncastStrategy({
47
+ scope: 'item',
48
+ attributeName: 'listItemItalic',
49
+ setAttributeOnDowncast(writer, value, viewElement) {
50
+ if (value) {
51
+ writer.addClass('ck-list-marker-italic', viewElement);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ afterInit() {
60
+ const editor = this.editor;
61
+ const model = editor.model;
62
+ if (!editor.plugins.has('ItalicEditing') || !this.editor.config.get('list.enableListItemMarkerFormatting')) {
63
+ return;
64
+ }
65
+ model.schema.extend('$listItem', { allowAttributes: 'listItemItalic' });
66
+ model.schema.setAttributeProperties('listItemItalic', {
67
+ isFormatting: true
68
+ });
69
+ model.schema.addAttributeCheck(context => {
70
+ const item = context.last;
71
+ if (!item.getAttribute('listItemId')) {
72
+ return false;
73
+ }
74
+ }, 'listItemItalic');
75
+ editor.conversion.for('upcast').attributeToAttribute({
76
+ model: 'listItemItalic',
77
+ view: {
78
+ name: 'li',
79
+ classes: 'ck-list-marker-italic'
80
+ }
81
+ });
82
+ }
83
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module list/listformatting
7
+ */
8
+ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
9
+ import { ListItemBoldIntegration } from './listformatting/listitemboldintegration.js';
10
+ import { ListItemItalicIntegration } from './listformatting/listitemitalicintegration.js';
11
+ import { ListItemFontSizeIntegration } from './listformatting/listitemfontsizeintegration.js';
12
+ import { ListItemFontColorIntegration } from './listformatting/listitemfontcolorintegration.js';
13
+ import { ListItemFontFamilyIntegration } from './listformatting/listitemfontfamilyintegration.js';
14
+ import '../theme/listformatting.css';
15
+ /**
16
+ * The list formatting plugin.
17
+ *
18
+ * It enables integration with formatting plugins to style the list marker.
19
+ * The list marker is styled based on the consistent formatting applied to the content of the list item.
20
+ *
21
+ * The list of supported formatting plugins includes:
22
+ * * Font color.
23
+ * * Font size.
24
+ * * Font family.
25
+ * * Bold.
26
+ * * Italic.
27
+ */
28
+ export declare class ListFormatting extends Plugin {
29
+ /**
30
+ * The list of loaded formatting.
31
+ */
32
+ private readonly _loadedFormatting;
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ static get pluginName(): "ListFormatting";
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ static get isOfficialPlugin(): true;
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ static get requires(): readonly [typeof ListItemBoldIntegration, typeof ListItemItalicIntegration, typeof ListItemFontSizeIntegration, typeof ListItemFontColorIntegration, typeof ListItemFontFamilyIntegration];
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ constructor(editor: Editor);
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ afterInit(): void;
53
+ /**
54
+ * Registers a postfixer that ensures that the list item formatting attribute is consistent with the formatting
55
+ * applied to the content of the list item.
56
+ */
57
+ private _registerPostfixerForListItemFormatting;
58
+ /**
59
+ * Registers an integration between a default attribute (e.g., `fontFamily`) and a new attribute
60
+ * intended specifically for list item elements (e.g., `listItemFontFamily`).
61
+ *
62
+ * These attributes are later used by the postfixer logic to determine whether to add the new attribute
63
+ * to the list item element, based on whether there is a consistent default formatting attribute
64
+ * applied within its content.
65
+ */
66
+ registerFormatAttribute(formatAttribute: string, listItemFormatAttribute: string): void;
67
+ /**
68
+ * Returns true if the given model attribute name is a supported inline formatting attribute.
69
+ */
70
+ private _isInlineOrSelectionFormatting;
71
+ }