@ckeditor/ckeditor5-list 46.0.0-alpha.3 → 46.0.0-alpha.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-list",
3
- "version": "46.0.0-alpha.3",
3
+ "version": "46.0.0-alpha.4",
4
4
  "description": "Ordered and unordered lists feature to CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,16 +13,16 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.3",
17
- "@ckeditor/ckeditor5-core": "46.0.0-alpha.3",
18
- "@ckeditor/ckeditor5-engine": "46.0.0-alpha.3",
19
- "@ckeditor/ckeditor5-enter": "46.0.0-alpha.3",
20
- "@ckeditor/ckeditor5-font": "46.0.0-alpha.3",
21
- "@ckeditor/ckeditor5-icons": "46.0.0-alpha.3",
22
- "@ckeditor/ckeditor5-typing": "46.0.0-alpha.3",
23
- "@ckeditor/ckeditor5-ui": "46.0.0-alpha.3",
24
- "@ckeditor/ckeditor5-utils": "46.0.0-alpha.3",
25
- "ckeditor5": "46.0.0-alpha.3"
16
+ "@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.4",
17
+ "@ckeditor/ckeditor5-core": "46.0.0-alpha.4",
18
+ "@ckeditor/ckeditor5-engine": "46.0.0-alpha.4",
19
+ "@ckeditor/ckeditor5-enter": "46.0.0-alpha.4",
20
+ "@ckeditor/ckeditor5-font": "46.0.0-alpha.4",
21
+ "@ckeditor/ckeditor5-icons": "46.0.0-alpha.4",
22
+ "@ckeditor/ckeditor5-typing": "46.0.0-alpha.4",
23
+ "@ckeditor/ckeditor5-ui": "46.0.0-alpha.4",
24
+ "@ckeditor/ckeditor5-utils": "46.0.0-alpha.4",
25
+ "ckeditor5": "46.0.0-alpha.4"
26
26
  },
27
27
  "author": "CKSource (http://cksource.com/)",
28
28
  "license": "SEE LICENSE IN LICENSE.md",
@@ -135,8 +135,11 @@ export function reconvertItemsOnDataChange(model, editing, attributeNames, listE
135
135
  stack.length = itemIndent + 1;
136
136
  }
137
137
  // Update the stack for the current indent level.
138
- stack[itemIndent] = Object.fromEntries(Array.from(node.getAttributes())
139
- .filter(([key]) => attributeNames.includes(key)));
138
+ stack[itemIndent] = {
139
+ modelAttributes: Object.fromEntries(Array.from(node.getAttributes())
140
+ .filter(([key]) => attributeNames.includes(key))),
141
+ modelElement: node
142
+ };
140
143
  // Find all blocks of the current node.
141
144
  const blocks = getListItemBlocks(node, { direction: 'forward' });
142
145
  for (const block of blocks) {
@@ -194,7 +197,8 @@ export function reconvertItemsOnDataChange(model, editing, attributeNames, listE
194
197
  const eventName = `checkAttributes:${isListItemElement ? 'item' : 'list'}`;
195
198
  const needsRefresh = listEditing.fire(eventName, {
196
199
  viewElement: element,
197
- modelAttributes: stack[indent]
200
+ modelAttributes: stack[indent].modelAttributes,
201
+ modelReferenceElement: stack[indent].modelElement
198
202
  });
199
203
  if (needsRefresh) {
200
204
  break;
@@ -11,6 +11,7 @@ import { Delete } from 'ckeditor5/src/typing.js';
11
11
  import { Enter } from 'ckeditor5/src/enter.js';
12
12
  import { ListFormatting } from '../listformatting.js';
13
13
  import { ListUtils } from './listutils.js';
14
+ import { type ListElement } from './utils/model.js';
14
15
  import { ListBlocksIterable } from './utils/listwalker.js';
15
16
  import { ClipboardPipeline } from 'ckeditor5/src/clipboard.js';
16
17
  import '../../theme/documentlist.css';
@@ -205,6 +206,7 @@ export type ListEditingCheckAttributesEvent = {
205
206
  id?: string;
206
207
  };
207
208
  modelAttributes: ListItemAttributesMap;
209
+ modelReferenceElement: ListElement;
208
210
  }
209
211
  ];
210
212
  return: boolean;
@@ -81,8 +81,11 @@ export class ListPropertiesEditing extends Plugin {
81
81
  }
82
82
  });
83
83
  // Verify if the list view element (ul or ol) requires refreshing.
84
- listEditing.on('checkAttributes:list', (evt, { viewElement, modelAttributes }) => {
84
+ listEditing.on('checkAttributes:list', (evt, { viewElement, modelAttributes, modelReferenceElement }) => {
85
85
  for (const strategy of strategies) {
86
+ if (!strategy.appliesToListItem(modelReferenceElement)) {
87
+ continue;
88
+ }
86
89
  if (strategy.getAttributeOnUpcast(viewElement) != modelAttributes[strategy.attributeName]) {
87
90
  evt.return = true;
88
91
  evt.stop();
@@ -10,6 +10,24 @@
10
10
  }
11
11
 
12
12
  .ck-content li {
13
+ /* Opinionated list content styling: prevents content shift
14
+ * when a list becomes multi-block (Enter + Backspace scenario).
15
+ * See: https://github.com/ckeditor/ckeditor5/pull/18801
16
+ */
17
+ & > p:first-of-type {
18
+ margin-top: 0;
19
+ }
20
+
21
+ /* Prevents margins from appearing when a bogus paragraph
22
+ * receives line height or text alignment.
23
+ * Ensures a consistent experience with the first paragraph.
24
+ * See: https://github.com/ckeditor/ckeditor5/pull/18801
25
+ */
26
+ & > p:only-child {
27
+ margin-top: 0;
28
+ margin-bottom: 0;
29
+ }
30
+
13
31
  &.ck-list-marker-bold::marker {
14
32
  font-weight: bold;
15
33
  }