@ckeditor/ckeditor5-list 47.2.0 → 47.3.0-alpha.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/dist/index.js CHANGED
@@ -2330,7 +2330,7 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
2330
2330
  * @param strategies The strategies.
2331
2331
  * @param model The model.
2332
2332
  */ function listItemDowncastConverter(attributeNames, strategies, model, { dataPipeline } = {}) {
2333
- const consumer = createAttributesConsumer(attributeNames);
2333
+ const consumer = createAttributesConsumer(attributeNames, strategies);
2334
2334
  return (evt, data, conversionApi)=>{
2335
2335
  const { writer, mapper, consumable } = conversionApi;
2336
2336
  const listItem = data.item;
@@ -2568,7 +2568,7 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
2568
2568
  const listViewElement = createListElement(writer, indent, currentListItem.getAttribute('listType'));
2569
2569
  for (const strategy of strategies){
2570
2570
  if ((strategy.scope == 'list' || strategy.scope == 'item') && currentListItem.hasAttribute(strategy.attributeName)) {
2571
- strategy.setAttributeOnDowncast(writer, currentListItem.getAttribute(strategy.attributeName), strategy.scope == 'list' ? listViewElement : listItemViewElement, options);
2571
+ strategy.setAttributeOnDowncast(writer, currentListItem.getAttribute(strategy.attributeName), strategy.scope == 'list' ? listViewElement : listItemViewElement, options, currentListItem);
2572
2572
  }
2573
2573
  }
2574
2574
  viewRange = writer.wrap(viewRange, listItemViewElement);
@@ -2587,12 +2587,13 @@ import { DomEventObserver, Matcher, ModelTreeWalker, getViewFillerOffset } from
2587
2587
  }
2588
2588
  }
2589
2589
  // Returns the function that is responsible for consuming attributes that are set on the model node.
2590
- function createAttributesConsumer(attributeNames) {
2590
+ function createAttributesConsumer(attributeNames, strategies) {
2591
+ const nonConsumingAttributes = strategies.filter((strategy)=>strategy.consume === false).map((strategy)=>strategy.attributeName);
2591
2592
  return (node, consumable)=>{
2592
2593
  const events = [];
2593
2594
  // Collect all set attributes that are triggering conversion.
2594
2595
  for (const attributeName of attributeNames){
2595
- if (node.hasAttribute(attributeName)) {
2596
+ if (node.hasAttribute(attributeName) && !nonConsumingAttributes.includes(attributeName)) {
2596
2597
  events.push(`attribute:${attributeName}`);
2597
2598
  }
2598
2599
  }