@portabletext/editor 1.49.9 → 1.49.10
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.cjs +12 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +12 -5
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/editor/create-editor.ts +10 -4
- package/src/internal-utils/applyPatch.ts +6 -2
package/lib/index.js
CHANGED
|
@@ -4232,8 +4232,8 @@ function insertPatch(editor, patch, schema) {
|
|
|
4232
4232
|
const editorWasEmptyBefore = isEqualToEmptyEditor(editor.children, schema);
|
|
4233
4233
|
return Transforms.insertNodes(editor, blocksToInsert, {
|
|
4234
4234
|
at: [normalizedIdx2]
|
|
4235
|
-
}), editorWasEmptyBefore && Transforms.removeNodes(editor, {
|
|
4236
|
-
at: [position2 === "
|
|
4235
|
+
}), editorWasEmptyBefore && typeof patch.path[0] == "number" && patch.path[0] === 0 && Transforms.removeNodes(editor, {
|
|
4236
|
+
at: [position2 === "before" ? targetBlockIndex + 1 : targetBlockIndex]
|
|
4237
4237
|
}), debugState(editor, "after"), !0;
|
|
4238
4238
|
}
|
|
4239
4239
|
const {
|
|
@@ -8943,8 +8943,8 @@ function createActors(config) {
|
|
|
8943
8943
|
subscription.unsubscribe();
|
|
8944
8944
|
};
|
|
8945
8945
|
}), config.subscriptions.push(() => {
|
|
8946
|
-
const subscription = config.editorActor.
|
|
8947
|
-
|
|
8946
|
+
const subscription = config.editorActor.subscribe((snapshot) => {
|
|
8947
|
+
snapshot.matches({
|
|
8948
8948
|
"edit mode": "read only"
|
|
8949
8949
|
}) ? syncActor.send({
|
|
8950
8950
|
type: "update readOnly",
|
|
@@ -8952,7 +8952,14 @@ function createActors(config) {
|
|
|
8952
8952
|
}) : syncActor.send({
|
|
8953
8953
|
type: "update readOnly",
|
|
8954
8954
|
readOnly: !1
|
|
8955
|
-
})
|
|
8955
|
+
});
|
|
8956
|
+
});
|
|
8957
|
+
return () => {
|
|
8958
|
+
subscription.unsubscribe();
|
|
8959
|
+
};
|
|
8960
|
+
}), config.subscriptions.push(() => {
|
|
8961
|
+
const subscription = config.editorActor.on("*", (event) => {
|
|
8962
|
+
event.type === "internal.patch" && mutationActor.send({
|
|
8956
8963
|
...event,
|
|
8957
8964
|
type: "patch"
|
|
8958
8965
|
});
|