@portabletext/editor 7.0.4 → 7.0.5

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/lib/index.js CHANGED
@@ -8606,7 +8606,9 @@ function getDirtyPaths(context, op) {
8606
8606
  const childNode = child, childPath = [{
8607
8607
  _key: childNode._key
8608
8608
  }];
8609
- levels2.push(childPath), collectDescendantPaths(context, childNode, childPath, levels2);
8609
+ levels2.push(childPath);
8610
+ const childRegistration = context.containers.get(childNode._type);
8611
+ collectDescendantPaths(context, childNode, childPath, levels2, childRegistration);
8610
8612
  }
8611
8613
  return levels2;
8612
8614
  }
@@ -8614,8 +8616,8 @@ function getDirtyPaths(context, op) {
8614
8616
  if (isKeyedSegment(propertyName)) {
8615
8617
  const levels2 = pathLevels(op.path);
8616
8618
  if (op.value !== null && typeof op.value == "object" && !Array.isArray(op.value)) {
8617
- const valueNode = op.value;
8618
- collectDescendantPaths(context, valueNode, op.path, levels2);
8619
+ const valueNode = op.value, valueRegistration = resolveContainerAt(context.containers, context.value, op.path);
8620
+ collectDescendantPaths(context, valueNode, op.path, levels2, valueRegistration && "field" in valueRegistration ? valueRegistration : void 0);
8619
8621
  }
8620
8622
  return levels2;
8621
8623
  }
@@ -8627,7 +8629,8 @@ function getDirtyPaths(context, op) {
8627
8629
  }]);
8628
8630
  }
8629
8631
  const levels = pathLevels(dirtyPath);
8630
- if (Array.isArray(op.value) && typeof propertyName == "string" && getChildFieldName(context, nodePath) === propertyName)
8632
+ if (Array.isArray(op.value) && typeof propertyName == "string" && getChildFieldName(context, nodePath) === propertyName) {
8633
+ const parentRegistration = resolveContainerAt(context.containers, context.value, nodePath), seed = parentRegistration && "field" in parentRegistration ? parentRegistration : void 0;
8631
8634
  for (let i = 0; i < op.value.length; i++) {
8632
8635
  const child = op.value[i];
8633
8636
  if (typeof child != "object" || child === null || !("_key" in child) || typeof child._key != "string")
@@ -8635,8 +8638,9 @@ function getDirtyPaths(context, op) {
8635
8638
  const childNode = child, childPath = [...nodePath, propertyName, {
8636
8639
  _key: childNode._key
8637
8640
  }];
8638
- levels.push(childPath), collectDescendantPaths(context, childNode, childPath, levels);
8641
+ levels.push(childPath), collectDescendantPaths(context, childNode, childPath, levels, seed);
8639
8642
  }
8643
+ }
8640
8644
  return levels;
8641
8645
  }
8642
8646
  case "unset": {
@@ -8680,7 +8684,10 @@ function getDirtyPaths(context, op) {
8680
8684
  };
8681
8685
  break;
8682
8686
  }
8683
- return levels.push(nodePath), isSpan(context, node) || collectDescendantPaths(context, node, nodePath, levels), levels;
8687
+ if (levels.push(nodePath), isSpan(context, node))
8688
+ return levels;
8689
+ const parentRegistration = resolveContainerAt(context.containers, context.value, parentPath(nodePath));
8690
+ return collectDescendantPaths(context, node, nodePath, levels, parentRegistration && "field" in parentRegistration ? parentRegistration : void 0), levels;
8684
8691
  }
8685
8692
  default:
8686
8693
  return [];