@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.cjs
CHANGED
|
@@ -4204,8 +4204,8 @@ function insertPatch(editor, patch, schema2) {
|
|
|
4204
4204
|
const editorWasEmptyBefore = isEqualToEmptyEditor(editor.children, schema2);
|
|
4205
4205
|
return slate.Transforms.insertNodes(editor, blocksToInsert, {
|
|
4206
4206
|
at: [normalizedIdx2]
|
|
4207
|
-
}), editorWasEmptyBefore && slate.Transforms.removeNodes(editor, {
|
|
4208
|
-
at: [position2 === "
|
|
4207
|
+
}), editorWasEmptyBefore && typeof patch.path[0] == "number" && patch.path[0] === 0 && slate.Transforms.removeNodes(editor, {
|
|
4208
|
+
at: [position2 === "before" ? targetBlockIndex + 1 : targetBlockIndex]
|
|
4209
4209
|
}), debugState(editor, "after"), !0;
|
|
4210
4210
|
}
|
|
4211
4211
|
const {
|
|
@@ -8915,8 +8915,8 @@ function createActors(config) {
|
|
|
8915
8915
|
subscription.unsubscribe();
|
|
8916
8916
|
};
|
|
8917
8917
|
}), config.subscriptions.push(() => {
|
|
8918
|
-
const subscription = config.editorActor.
|
|
8919
|
-
|
|
8918
|
+
const subscription = config.editorActor.subscribe((snapshot) => {
|
|
8919
|
+
snapshot.matches({
|
|
8920
8920
|
"edit mode": "read only"
|
|
8921
8921
|
}) ? syncActor.send({
|
|
8922
8922
|
type: "update readOnly",
|
|
@@ -8924,7 +8924,14 @@ function createActors(config) {
|
|
|
8924
8924
|
}) : syncActor.send({
|
|
8925
8925
|
type: "update readOnly",
|
|
8926
8926
|
readOnly: !1
|
|
8927
|
-
})
|
|
8927
|
+
});
|
|
8928
|
+
});
|
|
8929
|
+
return () => {
|
|
8930
|
+
subscription.unsubscribe();
|
|
8931
|
+
};
|
|
8932
|
+
}), config.subscriptions.push(() => {
|
|
8933
|
+
const subscription = config.editorActor.on("*", (event) => {
|
|
8934
|
+
event.type === "internal.patch" && mutationActor.send({
|
|
8928
8935
|
...event,
|
|
8929
8936
|
type: "patch"
|
|
8930
8937
|
});
|