@portabletext/editor 6.0.8 → 6.0.9
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 +10 -1
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -20576,7 +20576,16 @@ function updateBlock({
|
|
|
20576
20576
|
const slateBlock = toSlateBlock(block, {
|
|
20577
20577
|
schemaTypes: context.schema
|
|
20578
20578
|
});
|
|
20579
|
-
|
|
20579
|
+
applySetNode(slateEditor, slateBlock, [index]);
|
|
20580
|
+
const oldRecord = oldSlateBlock, newRecord = slateBlock, removedProperties = {};
|
|
20581
|
+
for (const key of Object.keys(oldRecord))
|
|
20582
|
+
key === "children" || key === "text" || newRecord.hasOwnProperty(key) || (removedProperties[key] = oldRecord[key]);
|
|
20583
|
+
if (Object.keys(removedProperties).length > 0 && slateEditor.apply({
|
|
20584
|
+
type: "set_node",
|
|
20585
|
+
path: [index],
|
|
20586
|
+
properties: removedProperties,
|
|
20587
|
+
newProperties: {}
|
|
20588
|
+
}), slateEditor.isTextBlock(slateBlock) && slateEditor.isTextBlock(oldSlateBlock)) {
|
|
20580
20589
|
const oldBlockChildrenLength = oldSlateBlock.children.length;
|
|
20581
20590
|
slateBlock.children.length < oldBlockChildrenLength && Array.from(Array(oldBlockChildrenLength - slateBlock.children.length)).forEach((_, i) => {
|
|
20582
20591
|
const childIndex = oldBlockChildrenLength - 1 - i;
|