@portabletext/editor 2.4.3 → 2.5.0
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.cts +25 -10
- package/lib/_chunks-dts/behavior.types.action.d.ts +25 -10
- package/lib/index.cjs +214 -140
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +215 -141
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +3 -3
- package/lib/plugins/index.d.ts +3 -3
- package/package.json +5 -5
- package/src/editor/Editable.tsx +90 -103
|
@@ -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 react21 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(): react21.JSX.Element;
|
|
219
219
|
/**
|
|
220
220
|
* @deprecated
|
|
221
221
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -577,7 +577,6 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
577
577
|
onBeforeInput?: (event: InputEvent) => void;
|
|
578
578
|
onPaste?: OnPasteFn;
|
|
579
579
|
onCopy?: OnCopyFn;
|
|
580
|
-
ref: MutableRefObject<HTMLDivElement | null>;
|
|
581
580
|
rangeDecorations?: RangeDecoration[];
|
|
582
581
|
renderAnnotation?: RenderAnnotationFunction;
|
|
583
582
|
renderBlock?: RenderBlockFunction;
|
|
@@ -610,7 +609,23 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
610
609
|
* ```
|
|
611
610
|
* @group Components
|
|
612
611
|
*/
|
|
613
|
-
declare const PortableTextEditable:
|
|
612
|
+
declare const PortableTextEditable: react21.ForwardRefExoticComponent<Omit<TextareaHTMLAttributes<HTMLDivElement>, "onPaste" | "onBeforeInput" | "onCopy"> & {
|
|
613
|
+
hotkeys?: HotkeyOptions;
|
|
614
|
+
onBeforeInput?: (event: InputEvent) => void;
|
|
615
|
+
onPaste?: OnPasteFn;
|
|
616
|
+
onCopy?: OnCopyFn;
|
|
617
|
+
rangeDecorations?: RangeDecoration[];
|
|
618
|
+
renderAnnotation?: RenderAnnotationFunction;
|
|
619
|
+
renderBlock?: RenderBlockFunction;
|
|
620
|
+
renderChild?: RenderChildFunction;
|
|
621
|
+
renderDecorator?: RenderDecoratorFunction;
|
|
622
|
+
renderListItem?: RenderListItemFunction;
|
|
623
|
+
renderPlaceholder?: RenderPlaceholderFunction;
|
|
624
|
+
renderStyle?: RenderStyleFunction;
|
|
625
|
+
scrollSelectionIntoView?: ScrollSelectionIntoViewFunction;
|
|
626
|
+
selection?: EditorSelection;
|
|
627
|
+
spellCheck?: boolean;
|
|
628
|
+
} & react21.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
614
629
|
type DecoratedRange = BaseRange & {
|
|
615
630
|
rangeDecoration: RangeDecoration;
|
|
616
631
|
};
|
|
@@ -1339,7 +1354,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1354
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1355
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1356
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1357
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1358
|
} | {
|
|
1344
1359
|
type: "done loading";
|
|
1345
1360
|
} | {
|
|
@@ -1351,7 +1366,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1366
|
data: unknown;
|
|
1352
1367
|
} | {
|
|
1353
1368
|
type: "focused";
|
|
1354
|
-
event:
|
|
1369
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1370
|
} | {
|
|
1356
1371
|
type: "invalid value";
|
|
1357
1372
|
resolution: InvalidValueResolution | null;
|
|
@@ -2007,7 +2022,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2007
2022
|
type: "drop";
|
|
2008
2023
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2009
2024
|
type: "blurred";
|
|
2010
|
-
event:
|
|
2025
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
2011
2026
|
} | {
|
|
2012
2027
|
type: "done loading";
|
|
2013
2028
|
} | {
|
|
@@ -2019,7 +2034,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2019
2034
|
data: unknown;
|
|
2020
2035
|
} | {
|
|
2021
2036
|
type: "focused";
|
|
2022
|
-
event:
|
|
2037
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
2023
2038
|
} | {
|
|
2024
2039
|
type: "invalid value";
|
|
2025
2040
|
resolution: InvalidValueResolution | null;
|
|
@@ -2890,7 +2905,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2890
2905
|
type: "drop";
|
|
2891
2906
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2892
2907
|
type: "blurred";
|
|
2893
|
-
event:
|
|
2908
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
2894
2909
|
} | {
|
|
2895
2910
|
type: "done loading";
|
|
2896
2911
|
} | {
|
|
@@ -2902,7 +2917,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2902
2917
|
data: unknown;
|
|
2903
2918
|
} | {
|
|
2904
2919
|
type: "focused";
|
|
2905
|
-
event:
|
|
2920
|
+
event: react21.FocusEvent<HTMLDivElement, Element>;
|
|
2906
2921
|
} | {
|
|
2907
2922
|
type: "invalid value";
|
|
2908
2923
|
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/
|
|
@@ -577,7 +577,6 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
577
577
|
onBeforeInput?: (event: InputEvent) => void;
|
|
578
578
|
onPaste?: OnPasteFn;
|
|
579
579
|
onCopy?: OnCopyFn;
|
|
580
|
-
ref: MutableRefObject<HTMLDivElement | null>;
|
|
581
580
|
rangeDecorations?: RangeDecoration[];
|
|
582
581
|
renderAnnotation?: RenderAnnotationFunction;
|
|
583
582
|
renderBlock?: RenderBlockFunction;
|
|
@@ -610,7 +609,23 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
610
609
|
* ```
|
|
611
610
|
* @group Components
|
|
612
611
|
*/
|
|
613
|
-
declare const PortableTextEditable:
|
|
612
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<TextareaHTMLAttributes<HTMLDivElement>, "onPaste" | "onBeforeInput" | "onCopy"> & {
|
|
613
|
+
hotkeys?: HotkeyOptions;
|
|
614
|
+
onBeforeInput?: (event: InputEvent) => void;
|
|
615
|
+
onPaste?: OnPasteFn;
|
|
616
|
+
onCopy?: OnCopyFn;
|
|
617
|
+
rangeDecorations?: RangeDecoration[];
|
|
618
|
+
renderAnnotation?: RenderAnnotationFunction;
|
|
619
|
+
renderBlock?: RenderBlockFunction;
|
|
620
|
+
renderChild?: RenderChildFunction;
|
|
621
|
+
renderDecorator?: RenderDecoratorFunction;
|
|
622
|
+
renderListItem?: RenderListItemFunction;
|
|
623
|
+
renderPlaceholder?: RenderPlaceholderFunction;
|
|
624
|
+
renderStyle?: RenderStyleFunction;
|
|
625
|
+
scrollSelectionIntoView?: ScrollSelectionIntoViewFunction;
|
|
626
|
+
selection?: EditorSelection;
|
|
627
|
+
spellCheck?: boolean;
|
|
628
|
+
} & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
614
629
|
type DecoratedRange = BaseRange & {
|
|
615
630
|
rangeDecoration: RangeDecoration;
|
|
616
631
|
};
|
|
@@ -1339,7 +1354,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1354
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1355
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1356
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1357
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1358
|
} | {
|
|
1344
1359
|
type: "done loading";
|
|
1345
1360
|
} | {
|
|
@@ -1351,7 +1366,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1366
|
data: unknown;
|
|
1352
1367
|
} | {
|
|
1353
1368
|
type: "focused";
|
|
1354
|
-
event:
|
|
1369
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1370
|
} | {
|
|
1356
1371
|
type: "invalid value";
|
|
1357
1372
|
resolution: InvalidValueResolution | null;
|
|
@@ -2007,7 +2022,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2007
2022
|
type: "drop";
|
|
2008
2023
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2009
2024
|
type: "blurred";
|
|
2010
|
-
event:
|
|
2025
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2011
2026
|
} | {
|
|
2012
2027
|
type: "done loading";
|
|
2013
2028
|
} | {
|
|
@@ -2019,7 +2034,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2019
2034
|
data: unknown;
|
|
2020
2035
|
} | {
|
|
2021
2036
|
type: "focused";
|
|
2022
|
-
event:
|
|
2037
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2023
2038
|
} | {
|
|
2024
2039
|
type: "invalid value";
|
|
2025
2040
|
resolution: InvalidValueResolution | null;
|
|
@@ -2890,7 +2905,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2890
2905
|
type: "drop";
|
|
2891
2906
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2892
2907
|
type: "blurred";
|
|
2893
|
-
event:
|
|
2908
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2894
2909
|
} | {
|
|
2895
2910
|
type: "done loading";
|
|
2896
2911
|
} | {
|
|
@@ -2902,7 +2917,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2902
2917
|
data: unknown;
|
|
2903
2918
|
} | {
|
|
2904
2919
|
type: "focused";
|
|
2905
|
-
event:
|
|
2920
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2906
2921
|
} | {
|
|
2907
2922
|
type: "invalid value";
|
|
2908
2923
|
resolution: InvalidValueResolution | null;
|