@portabletext/editor 1.11.0 → 1.11.2

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
@@ -2538,8 +2538,10 @@ function createWithUndoRedo(options) {
2538
2538
  apply: apply2
2539
2539
  } = editor;
2540
2540
  return editor.apply = (op) => {
2541
- if (editorActor.getSnapshot().context.readOnly)
2541
+ if (editorActor.getSnapshot().context.readOnly) {
2542
+ apply2(op);
2542
2543
  return;
2544
+ }
2543
2545
  if (isChangingRemotely(editor)) {
2544
2546
  apply2(op);
2545
2547
  return;
@@ -3398,8 +3400,10 @@ function createWithMaxBlocks(editorActor) {
3398
3400
  apply: apply2
3399
3401
  } = editor;
3400
3402
  return editor.apply = (operation) => {
3401
- if (editorActor.getSnapshot().context.readOnly)
3403
+ if (editorActor.getSnapshot().context.readOnly) {
3404
+ apply2(operation);
3402
3405
  return;
3406
+ }
3403
3407
  if (isChangingRemotely(editor)) {
3404
3408
  apply2(operation);
3405
3409
  return;
@@ -3846,26 +3850,28 @@ function createWithPlaceholderBlock(editorActor) {
3846
3850
  apply: apply2
3847
3851
  } = editor;
3848
3852
  return editor.apply = (op) => {
3849
- if (!editorActor.getSnapshot().context.readOnly) {
3850
- if (isChangingRemotely(editor)) {
3851
- apply2(op);
3852
- return;
3853
- }
3854
- if (isUndoing(editor) || isRedoing(editor)) {
3855
- apply2(op);
3856
- return;
3857
- }
3858
- if (op.type === "remove_node") {
3859
- const node = op.node;
3860
- if (op.path[0] === 0 && slate.Editor.isVoid(editor, node)) {
3861
- const nextPath = slate.Path.next(op.path);
3862
- editor.children[nextPath[0]] || (debug$d("Adding placeholder block"), slate.Editor.insertNode(editor, editor.pteCreateTextBlock({
3863
- decorators: []
3864
- })));
3865
- }
3866
- }
3853
+ if (editorActor.getSnapshot().context.readOnly) {
3867
3854
  apply2(op);
3855
+ return;
3868
3856
  }
3857
+ if (isChangingRemotely(editor)) {
3858
+ apply2(op);
3859
+ return;
3860
+ }
3861
+ if (isUndoing(editor) || isRedoing(editor)) {
3862
+ apply2(op);
3863
+ return;
3864
+ }
3865
+ if (op.type === "remove_node") {
3866
+ const node = op.node;
3867
+ if (op.path[0] === 0 && slate.Editor.isVoid(editor, node)) {
3868
+ const nextPath = slate.Path.next(op.path);
3869
+ editor.children[nextPath[0]] || (debug$d("Adding placeholder block"), slate.Editor.insertNode(editor, editor.pteCreateTextBlock({
3870
+ decorators: []
3871
+ })));
3872
+ }
3873
+ }
3874
+ apply2(op);
3869
3875
  }, editor;
3870
3876
  };
3871
3877
  }
@@ -5717,7 +5723,7 @@ const editorMachine = xstate.setup({
5717
5723
  event: event.behaviorEvent
5718
5724
  }, shouldRun));
5719
5725
  for (const actionIntends of actionIntendSets)
5720
- behaviorOverwritten = actionIntends.length > 0 && actionIntends.some((actionIntend) => actionIntend.type !== "effect"), enqueue.raise({
5726
+ behaviorOverwritten = behaviorOverwritten || actionIntends.length > 0 && actionIntends.some((actionIntend) => actionIntend.type !== "effect"), enqueue.raise({
5721
5727
  type: "behavior action intends",
5722
5728
  editor: event.editor,
5723
5729
  actionIntends