@portabletext/editor 2.21.2 → 2.21.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.
|
@@ -1697,7 +1697,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
1697
1697
|
}, xstate229.AnyEventObject>;
|
|
1698
1698
|
}) => {
|
|
1699
1699
|
behaviors: Set<{
|
|
1700
|
-
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "
|
|
1700
|
+
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "style.*" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
|
|
1701
1701
|
type: StrictExtract<"split" | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.add">;
|
|
1702
1702
|
annotation: {
|
|
1703
1703
|
name: string;
|
package/lib/index.js
CHANGED
|
@@ -5661,6 +5661,32 @@ function setPatch(editor, patch) {
|
|
|
5661
5661
|
if (!block)
|
|
5662
5662
|
return !1;
|
|
5663
5663
|
const isTextBlock2 = editor.isTextBlock(block.node);
|
|
5664
|
+
if (patch.path.length === 1) {
|
|
5665
|
+
const updatedBlock = applyAll(block.node, [{
|
|
5666
|
+
...patch,
|
|
5667
|
+
path: patch.path.slice(1)
|
|
5668
|
+
}]);
|
|
5669
|
+
if (editor.isTextBlock(block.node) && Element$1.isElement(updatedBlock)) {
|
|
5670
|
+
Transforms.setNodes(editor, updatedBlock, {
|
|
5671
|
+
at: [block.index]
|
|
5672
|
+
});
|
|
5673
|
+
const previousSelection = editor.selection;
|
|
5674
|
+
for (const [_, childPath] of Editor.nodes(editor, {
|
|
5675
|
+
at: [block.index],
|
|
5676
|
+
reverse: !0,
|
|
5677
|
+
mode: "lowest"
|
|
5678
|
+
}))
|
|
5679
|
+
Transforms.removeNodes(editor, {
|
|
5680
|
+
at: childPath
|
|
5681
|
+
});
|
|
5682
|
+
return Transforms.insertNodes(editor, updatedBlock.children, {
|
|
5683
|
+
at: [block.index, 0]
|
|
5684
|
+
}), previousSelection && (Transforms.setSelection(editor, previousSelection), Transforms.select(editor, previousSelection)), !0;
|
|
5685
|
+
} else
|
|
5686
|
+
return Transforms.setNodes(editor, updatedBlock, {
|
|
5687
|
+
at: [block.index]
|
|
5688
|
+
}), !0;
|
|
5689
|
+
}
|
|
5664
5690
|
if (isTextBlock2 && patch.path[1] !== "children") {
|
|
5665
5691
|
const updatedBlock = applyAll(block.node, [{
|
|
5666
5692
|
...patch,
|