@portabletext/editor 2.15.2 → 2.15.3

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
@@ -6023,17 +6023,26 @@ function setNodePatch(schema, children, operation) {
6023
6023
  _key: block._key
6024
6024
  }, key]));
6025
6025
  }
6026
+ for (const key of Object.keys(operation.properties))
6027
+ key in operation.newProperties || patches.push(unset([{
6028
+ _key: block._key
6029
+ }, key]));
6026
6030
  return patches;
6027
6031
  } else {
6028
6032
  const patches = [], _key = operation.newProperties._key;
6029
6033
  _key !== void 0 && patches.push(set(_key, [blockIndex, "_key"]));
6030
- const properties = "value" in operation.newProperties && typeof operation.newProperties.value == "object" ? operation.newProperties.value : {}, keys = Object.keys(properties);
6034
+ const newValue = "value" in operation.newProperties && typeof operation.newProperties.value == "object" ? operation.newProperties.value : {}, keys = Object.keys(newValue);
6031
6035
  for (const key of keys) {
6032
- const value = properties[key];
6033
- patches.push(set(value, [{
6036
+ const value2 = newValue[key];
6037
+ patches.push(set(value2, [{
6034
6038
  _key: block._key
6035
6039
  }, key]));
6036
6040
  }
6041
+ const value = "value" in operation.properties && typeof operation.properties.value == "object" ? operation.properties.value : {};
6042
+ for (const key of Object.keys(value))
6043
+ key in newValue || patches.push(unset([{
6044
+ _key: block._key
6045
+ }, key]));
6037
6046
  return patches;
6038
6047
  }
6039
6048
  } else if (operation.path.length === 2) {