@portabletext/editor 2.1.7 → 2.1.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 CHANGED
@@ -4,7 +4,7 @@ import { useEditor, EditorContext } from "./_chunks-es/use-editor.js";
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
5
  import { useSelector, useActorRef } from "@xstate/react";
6
6
  import noop from "lodash/noop.js";
7
- import { Element as Element$1, Text, Range, Editor, Node, Transforms, Path, Operation, Point, createEditor } from "slate";
7
+ import { Element as Element$1, Text, Range, Editor, Node, Transforms, Path, Operation, Point, createEditor, deleteText } from "slate";
8
8
  import { useSelected, useSlateSelector, useSlateStatic, withReact, ReactEditor, Slate, useSlate, Editable } from "slate-react";
9
9
  import debug$f from "debug";
10
10
  import { DOMEditor, isDOMNode, EDITOR_TO_PENDING_SELECTION } from "slate-dom";
@@ -2138,8 +2138,8 @@ function deisolateChar(diffs, i, dir) {
2138
2138
  }
2139
2139
  }
2140
2140
  if (insertIdx !== null && deleteIdx !== null && hasSharedChar(diffs, insertIdx, deleteIdx, dir)) {
2141
- const [insertText, insertChar] = splitChar(diffs[insertIdx][1], inv), [deleteText] = splitChar(diffs[deleteIdx][1], inv);
2142
- diffs[insertIdx][1] = insertText, diffs[deleteIdx][1] = deleteText, diffs[i][1] = combineChar(diffs[i][1], insertChar, dir);
2141
+ const [insertText, insertChar] = splitChar(diffs[insertIdx][1], inv), [deleteText2] = splitChar(diffs[deleteIdx][1], inv);
2142
+ diffs[insertIdx][1] = insertText, diffs[deleteIdx][1] = deleteText2, diffs[i][1] = combineChar(diffs[i][1], insertChar, dir);
2143
2143
  return;
2144
2144
  }
2145
2145
  const [text, char] = splitChar(diffs[i][1], dir);
@@ -9417,10 +9417,9 @@ const debug$4 = debugWithName("sync machine"), syncValueCallback = ({
9417
9417
  "is busy": ({
9418
9418
  context
9419
9419
  }) => {
9420
- const editable = !context.readOnly, isProcessingLocalChanges = context.isProcessingLocalChanges, isChanging = isChangingRemotely(context.slateEditor) ?? !1, isBusy = editable && (isProcessingLocalChanges || isChanging);
9420
+ const isProcessingLocalChanges = context.isProcessingLocalChanges, isChanging = isChangingRemotely(context.slateEditor) ?? !1, isBusy = isProcessingLocalChanges || isChanging;
9421
9421
  return debug$4("isBusy", {
9422
9422
  isBusy,
9423
- editable,
9424
9423
  isProcessingLocalChanges,
9425
9424
  isChanging
9426
9425
  }), isBusy;
@@ -9831,7 +9830,7 @@ function _updateBlock(slateEditor, currentBlock, oldBlock, currentBlockIndex) {
9831
9830
  at: path
9832
9831
  });
9833
9832
  const isSpanNode2 = Text.isText(currentBlockChild) && currentBlockChild._type === "span" && Text.isText(oldBlockChild) && oldBlockChild._type === "span";
9834
- isSpanNode2 && isTextChanged ? (oldBlockChild.text.length > 0 && Transforms.delete(slateEditor, {
9833
+ isSpanNode2 && isTextChanged ? (oldBlockChild.text.length > 0 && deleteText(slateEditor, {
9835
9834
  at: {
9836
9835
  focus: {
9837
9836
  path,