@portabletext/editor 6.0.4 → 6.0.6

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
@@ -12359,10 +12359,23 @@ function unsetPatch(editor, patch) {
12359
12359
  }, [block.index]), !0;
12360
12360
  }
12361
12361
  if (editor.isTextBlock(block.node)) {
12362
- const propEntry = patch.path.slice(1).at(0);
12363
- return propEntry === void 0 || typeof propEntry != "string" || ["_key", "_type", "children"].includes(propEntry) ? !1 : (applySetNode(editor, {
12364
- [propEntry]: null
12365
- }, [block.index]), !0);
12362
+ const propPath = patch.path.slice(1), propEntry = propPath.at(0);
12363
+ if (propEntry === void 0 || typeof propEntry != "string" || ["_key", "_type", "children"].includes(propEntry))
12364
+ return !1;
12365
+ if (propPath.length === 1)
12366
+ applySetNode(editor, {
12367
+ [propEntry]: null
12368
+ }, [block.index]);
12369
+ else {
12370
+ const updatedBlock = applyAll(block.node, [{
12371
+ ...patch,
12372
+ path: propPath
12373
+ }]);
12374
+ applySetNode(editor, {
12375
+ [propEntry]: updatedBlock[propEntry]
12376
+ }, [block.index]);
12377
+ }
12378
+ return !0;
12366
12379
  }
12367
12380
  return !1;
12368
12381
  }