@portabletext/editor 4.3.0 → 4.3.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 +10 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -11932,11 +11932,15 @@ const editorMachine = setup({
|
|
|
11932
11932
|
"mutation interval": fromCallback(({
|
|
11933
11933
|
sendBack
|
|
11934
11934
|
}) => {
|
|
11935
|
-
const interval = setInterval(
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11935
|
+
const interval = setInterval(
|
|
11936
|
+
() => {
|
|
11937
|
+
sendBack({
|
|
11938
|
+
type: "emit changes"
|
|
11939
|
+
});
|
|
11940
|
+
},
|
|
11941
|
+
// @ts-expect-error - dot notation required for Vite to replace at build time
|
|
11942
|
+
process.env.NODE_ENV === "test" ? 250 : 1e3
|
|
11943
|
+
);
|
|
11940
11944
|
return () => {
|
|
11941
11945
|
clearInterval(interval);
|
|
11942
11946
|
};
|
|
@@ -12967,7 +12971,7 @@ function updateBlock({
|
|
|
12967
12971
|
at: [index, childIndex]
|
|
12968
12972
|
}));
|
|
12969
12973
|
}), slateBlock.children.forEach((currentBlockChild, currentBlockChildIndex) => {
|
|
12970
|
-
const oldBlockChild = oldSlateBlock.children.at(currentBlockChildIndex), isChildChanged = oldBlockChild
|
|
12974
|
+
const oldBlockChild = oldSlateBlock.children.at(currentBlockChildIndex), isChildChanged = !oldBlockChild || !isEqualChild(currentBlockChild, oldBlockChild), isTextChanged = oldBlockChild && Text.isText(oldBlockChild) && currentBlockChild.text !== oldBlockChild.text, path = [index, currentBlockChildIndex];
|
|
12971
12975
|
if (isChildChanged)
|
|
12972
12976
|
if (currentBlockChild._key === oldBlockChild?._key) {
|
|
12973
12977
|
debug.syncValue("Updating changed child", currentBlockChild, oldBlockChild), Transforms.setNodes(slateEditor, currentBlockChild, {
|