@portabletext/editor 2.6.1 → 2.6.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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Patch, Patch as Patch$1 } from "@portabletext/patches";
|
|
2
2
|
import * as _sanity_types5 from "@sanity/types";
|
|
3
3
|
import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, ObjectSchemaType, Path, PortableTextBlock, PortableTextBlock as PortableTextBlock$1, PortableTextChild, PortableTextChild as PortableTextChild$1, PortableTextListBlock, PortableTextObject, PortableTextObject as PortableTextObject$1, PortableTextSpan, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$1, TypedObject } from "@sanity/types";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
5
5
|
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, defineSchema } from "@portabletext/schema";
|
|
6
6
|
import * as xstate227 from "xstate";
|
|
7
7
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
8
8
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react20 from "react";
|
|
10
10
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
11
11
|
import * as xstate_guards12 from "xstate/guards";
|
|
12
12
|
import { Observable, Subject } from "rxjs";
|
|
@@ -215,7 +215,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
215
215
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
216
216
|
componentWillUnmount(): void;
|
|
217
217
|
setEditable: (editable: EditableAPI) => void;
|
|
218
|
-
render():
|
|
218
|
+
render(): react20.JSX.Element;
|
|
219
219
|
/**
|
|
220
220
|
* @deprecated
|
|
221
221
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -610,7 +610,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
610
610
|
* ```
|
|
611
611
|
* @group Components
|
|
612
612
|
*/
|
|
613
|
-
declare const PortableTextEditable:
|
|
613
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
614
614
|
type DecoratedRange = BaseRange & {
|
|
615
615
|
rangeDecoration: RangeDecoration;
|
|
616
616
|
};
|
|
@@ -1339,7 +1339,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1339
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1340
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1341
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1342
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1343
|
} | {
|
|
1344
1344
|
type: "done loading";
|
|
1345
1345
|
} | {
|
|
@@ -1351,7 +1351,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1351
|
data: unknown;
|
|
1352
1352
|
} | {
|
|
1353
1353
|
type: "focused";
|
|
1354
|
-
event:
|
|
1354
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1355
|
} | {
|
|
1356
1356
|
type: "invalid value";
|
|
1357
1357
|
resolution: InvalidValueResolution | null;
|
|
@@ -1506,7 +1506,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1506
1506
|
}, xstate227.AnyEventObject>;
|
|
1507
1507
|
}) => {
|
|
1508
1508
|
behaviors: Set<{
|
|
1509
|
-
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.inline object" | "insert.block" | "insert.span" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.soft break" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "
|
|
1509
|
+
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.inline object" | "insert.block" | "insert.span" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.soft break" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "style.*" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
|
|
1510
1510
|
type: StrictExtract<"split" | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.inline object" | "insert.block" | "insert.span" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.soft break" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.add">;
|
|
1511
1511
|
annotation: {
|
|
1512
1512
|
name: string;
|
|
@@ -1784,7 +1784,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1784
1784
|
keyGenerator: () => string;
|
|
1785
1785
|
pendingEvents: never[];
|
|
1786
1786
|
pendingIncomingPatchesEvents: never[];
|
|
1787
|
-
schema:
|
|
1787
|
+
schema: _portabletext_schema5.Schema;
|
|
1788
1788
|
selection: null;
|
|
1789
1789
|
initialReadOnly: boolean;
|
|
1790
1790
|
maxBlocks: number | undefined;
|
|
@@ -2007,7 +2007,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2007
2007
|
type: "drop";
|
|
2008
2008
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2009
2009
|
type: "blurred";
|
|
2010
|
-
event:
|
|
2010
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2011
2011
|
} | {
|
|
2012
2012
|
type: "done loading";
|
|
2013
2013
|
} | {
|
|
@@ -2019,7 +2019,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2019
2019
|
data: unknown;
|
|
2020
2020
|
} | {
|
|
2021
2021
|
type: "focused";
|
|
2022
|
-
event:
|
|
2022
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2023
2023
|
} | {
|
|
2024
2024
|
type: "invalid value";
|
|
2025
2025
|
resolution: InvalidValueResolution | null;
|
|
@@ -2890,7 +2890,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2890
2890
|
type: "drop";
|
|
2891
2891
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2892
2892
|
type: "blurred";
|
|
2893
|
-
event:
|
|
2893
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2894
2894
|
} | {
|
|
2895
2895
|
type: "done loading";
|
|
2896
2896
|
} | {
|
|
@@ -2902,7 +2902,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2902
2902
|
data: unknown;
|
|
2903
2903
|
} | {
|
|
2904
2904
|
type: "focused";
|
|
2905
|
-
event:
|
|
2905
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2906
2906
|
} | {
|
|
2907
2907
|
type: "invalid value";
|
|
2908
2908
|
resolution: InvalidValueResolution | null;
|
|
@@ -6,7 +6,7 @@ import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObject
|
|
|
6
6
|
import * as xstate227 from "xstate";
|
|
7
7
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
8
8
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react20 from "react";
|
|
10
10
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
11
11
|
import * as xstate_guards12 from "xstate/guards";
|
|
12
12
|
import { Observable, Subject } from "rxjs";
|
|
@@ -215,7 +215,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
215
215
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
216
216
|
componentWillUnmount(): void;
|
|
217
217
|
setEditable: (editable: EditableAPI) => void;
|
|
218
|
-
render():
|
|
218
|
+
render(): react20.JSX.Element;
|
|
219
219
|
/**
|
|
220
220
|
* @deprecated
|
|
221
221
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -610,7 +610,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
610
610
|
* ```
|
|
611
611
|
* @group Components
|
|
612
612
|
*/
|
|
613
|
-
declare const PortableTextEditable:
|
|
613
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
614
614
|
type DecoratedRange = BaseRange & {
|
|
615
615
|
rangeDecoration: RangeDecoration;
|
|
616
616
|
};
|
|
@@ -1339,7 +1339,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1339
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1340
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1341
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1342
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1343
|
} | {
|
|
1344
1344
|
type: "done loading";
|
|
1345
1345
|
} | {
|
|
@@ -1351,7 +1351,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1351
|
data: unknown;
|
|
1352
1352
|
} | {
|
|
1353
1353
|
type: "focused";
|
|
1354
|
-
event:
|
|
1354
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1355
|
} | {
|
|
1356
1356
|
type: "invalid value";
|
|
1357
1357
|
resolution: InvalidValueResolution | null;
|
|
@@ -2007,7 +2007,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2007
2007
|
type: "drop";
|
|
2008
2008
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2009
2009
|
type: "blurred";
|
|
2010
|
-
event:
|
|
2010
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2011
2011
|
} | {
|
|
2012
2012
|
type: "done loading";
|
|
2013
2013
|
} | {
|
|
@@ -2019,7 +2019,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2019
2019
|
data: unknown;
|
|
2020
2020
|
} | {
|
|
2021
2021
|
type: "focused";
|
|
2022
|
-
event:
|
|
2022
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2023
2023
|
} | {
|
|
2024
2024
|
type: "invalid value";
|
|
2025
2025
|
resolution: InvalidValueResolution | null;
|
|
@@ -2890,7 +2890,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2890
2890
|
type: "drop";
|
|
2891
2891
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2892
2892
|
type: "blurred";
|
|
2893
|
-
event:
|
|
2893
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2894
2894
|
} | {
|
|
2895
2895
|
type: "done loading";
|
|
2896
2896
|
} | {
|
|
@@ -2902,7 +2902,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2902
2902
|
data: unknown;
|
|
2903
2903
|
} | {
|
|
2904
2904
|
type: "focused";
|
|
2905
|
-
event:
|
|
2905
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2906
2906
|
} | {
|
|
2907
2907
|
type: "invalid value";
|
|
2908
2908
|
resolution: InvalidValueResolution | null;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _sanity_types9 from "@sanity/types";
|
|
3
3
|
import { KeyedSegment, PortableTextBlock, PortableTextChild, PortableTextSpan, PortableTextTextBlock } from "@sanity/types";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
@@ -150,7 +150,7 @@ declare function mergeTextBlocks({
|
|
|
150
150
|
context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
|
|
151
151
|
targetBlock: PortableTextTextBlock;
|
|
152
152
|
incomingBlock: PortableTextTextBlock;
|
|
153
|
-
}): PortableTextTextBlock<
|
|
153
|
+
}): PortableTextTextBlock<_sanity_types9.PortableTextObject | _sanity_types9.PortableTextSpan>;
|
|
154
154
|
/**
|
|
155
155
|
* @public
|
|
156
156
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"slate-dom": "^0.117.4",
|
|
80
80
|
"slate-react": "0.117.4",
|
|
81
81
|
"xstate": "^5.20.2",
|
|
82
|
-
"@portabletext/block-tools": "^3.3.
|
|
82
|
+
"@portabletext/block-tools": "^3.3.3",
|
|
83
83
|
"@portabletext/keyboard-shortcuts": "^1.1.1",
|
|
84
84
|
"@portabletext/patches": "^1.1.8",
|
|
85
85
|
"@portabletext/schema": "^1.1.0"
|
|
@@ -111,11 +111,11 @@
|
|
|
111
111
|
"vite": "^7.1.3",
|
|
112
112
|
"vitest": "^3.2.4",
|
|
113
113
|
"vitest-browser-react": "^1.0.1",
|
|
114
|
-
"@portabletext/sanity-bridge": "1.1.
|
|
114
|
+
"@portabletext/sanity-bridge": "1.1.5",
|
|
115
115
|
"racejar": "1.2.14"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
|
-
"@portabletext/sanity-bridge": "^1.1.
|
|
118
|
+
"@portabletext/sanity-bridge": "^1.1.5",
|
|
119
119
|
"@sanity/schema": "^4.5.0",
|
|
120
120
|
"@sanity/types": "^4.5.0",
|
|
121
121
|
"react": "^18.3 || ^19",
|