@portabletext/editor 2.15.2 → 2.15.3
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.
|
@@ -3,7 +3,7 @@ import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDe
|
|
|
3
3
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
4
4
|
import * as xstate229 from "xstate";
|
|
5
5
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react19 from "react";
|
|
7
7
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
8
8
|
import { Patch, Patch as Patch$1 } from "@portabletext/patches";
|
|
9
9
|
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
@@ -219,7 +219,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
219
219
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
220
220
|
componentWillUnmount(): void;
|
|
221
221
|
setEditable: (editable: EditableAPI) => void;
|
|
222
|
-
render():
|
|
222
|
+
render(): react19.JSX.Element;
|
|
223
223
|
/**
|
|
224
224
|
* @deprecated
|
|
225
225
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -614,7 +614,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
614
614
|
* ```
|
|
615
615
|
* @group Components
|
|
616
616
|
*/
|
|
617
|
-
declare const PortableTextEditable:
|
|
617
|
+
declare const PortableTextEditable: react19.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react19.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
618
618
|
type DecoratedRange = BaseRange & {
|
|
619
619
|
rangeDecoration: RangeDecoration;
|
|
620
620
|
};
|
|
@@ -1532,7 +1532,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
1532
1532
|
initialValue?: Array<PortableTextBlock>;
|
|
1533
1533
|
}, xstate229.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1534
1534
|
type: "blurred";
|
|
1535
|
-
event:
|
|
1535
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
1536
1536
|
} | {
|
|
1537
1537
|
type: "done loading";
|
|
1538
1538
|
} | {
|
|
@@ -1544,7 +1544,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
1544
1544
|
data: unknown;
|
|
1545
1545
|
} | {
|
|
1546
1546
|
type: "focused";
|
|
1547
|
-
event:
|
|
1547
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
1548
1548
|
} | {
|
|
1549
1549
|
type: "invalid value";
|
|
1550
1550
|
resolution: InvalidValueResolution | null;
|
|
@@ -2205,7 +2205,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
2205
2205
|
editor: PortableTextSlateEditor;
|
|
2206
2206
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2207
2207
|
type: "blurred";
|
|
2208
|
-
event:
|
|
2208
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
2209
2209
|
} | {
|
|
2210
2210
|
type: "done loading";
|
|
2211
2211
|
} | {
|
|
@@ -2217,7 +2217,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
2217
2217
|
data: unknown;
|
|
2218
2218
|
} | {
|
|
2219
2219
|
type: "focused";
|
|
2220
|
-
event:
|
|
2220
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
2221
2221
|
} | {
|
|
2222
2222
|
type: "invalid value";
|
|
2223
2223
|
resolution: InvalidValueResolution | null;
|
|
@@ -3078,7 +3078,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
3078
3078
|
editor: PortableTextSlateEditor;
|
|
3079
3079
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
3080
3080
|
type: "blurred";
|
|
3081
|
-
event:
|
|
3081
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
3082
3082
|
} | {
|
|
3083
3083
|
type: "done loading";
|
|
3084
3084
|
} | {
|
|
@@ -3090,7 +3090,7 @@ declare const editorMachine: xstate229.StateMachine<{
|
|
|
3090
3090
|
data: unknown;
|
|
3091
3091
|
} | {
|
|
3092
3092
|
type: "focused";
|
|
3093
|
-
event:
|
|
3093
|
+
event: react19.FocusEvent<HTMLDivElement, Element>;
|
|
3094
3094
|
} | {
|
|
3095
3095
|
type: "invalid value";
|
|
3096
3096
|
resolution: InvalidValueResolution | null;
|
package/lib/index.cjs
CHANGED
|
@@ -5996,17 +5996,26 @@ function setNodePatch(schema$12, children, operation) {
|
|
|
5996
5996
|
_key: block._key
|
|
5997
5997
|
}, key]));
|
|
5998
5998
|
}
|
|
5999
|
+
for (const key of Object.keys(operation.properties))
|
|
6000
|
+
key in operation.newProperties || patches$1.push(patches.unset([{
|
|
6001
|
+
_key: block._key
|
|
6002
|
+
}, key]));
|
|
5999
6003
|
return patches$1;
|
|
6000
6004
|
} else {
|
|
6001
6005
|
const patches$1 = [], _key = operation.newProperties._key;
|
|
6002
6006
|
_key !== void 0 && patches$1.push(patches.set(_key, [blockIndex, "_key"]));
|
|
6003
|
-
const
|
|
6007
|
+
const newValue = "value" in operation.newProperties && typeof operation.newProperties.value == "object" ? operation.newProperties.value : {}, keys = Object.keys(newValue);
|
|
6004
6008
|
for (const key of keys) {
|
|
6005
|
-
const
|
|
6006
|
-
patches$1.push(patches.set(
|
|
6009
|
+
const value2 = newValue[key];
|
|
6010
|
+
patches$1.push(patches.set(value2, [{
|
|
6007
6011
|
_key: block._key
|
|
6008
6012
|
}, key]));
|
|
6009
6013
|
}
|
|
6014
|
+
const value = "value" in operation.properties && typeof operation.properties.value == "object" ? operation.properties.value : {};
|
|
6015
|
+
for (const key of Object.keys(value))
|
|
6016
|
+
key in newValue || patches$1.push(patches.unset([{
|
|
6017
|
+
_key: block._key
|
|
6018
|
+
}, key]));
|
|
6010
6019
|
return patches$1;
|
|
6011
6020
|
}
|
|
6012
6021
|
} else if (operation.path.length === 2) {
|