@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/_chunks-dts/behavior.types.action.d.ts +9 -9
- package/lib/index.cjs +2 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +5 -6
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/package.json +8 -8
- package/src/editor/sync-machine.ts +11 -5
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), [
|
|
2142
|
-
diffs[insertIdx][1] = insertText, diffs[deleteIdx][1] =
|
|
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
|
|
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 &&
|
|
9833
|
+
isSpanNode2 && isTextChanged ? (oldBlockChild.text.length > 0 && deleteText(slateEditor, {
|
|
9835
9834
|
at: {
|
|
9836
9835
|
focus: {
|
|
9837
9836
|
path,
|