@portabletext/editor 3.3.11 → 3.3.13
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/index.d.ts +60 -35
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +24 -46
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +1 -1
- package/lib/selectors/index.d.ts +2 -2
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.d.ts +4 -5
- package/lib/utils/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as _portabletext_schema12 from "@portabletext/schema";
|
|
2
|
+
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, 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, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, TypedObject, defineSchema } from "@portabletext/schema";
|
|
3
3
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
4
4
|
import * as xstate228 from "xstate";
|
|
5
5
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
6
6
|
import * as react18 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
|
-
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
10
|
-
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, PortableTextObject as PortableTextObject$1, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock as PortableTextTextBlock$1, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, defineSchema } from "@portabletext/schema";
|
|
11
9
|
import { Observable, Subject } from "rxjs";
|
|
10
|
+
import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, ObjectSchemaType } from "@sanity/types";
|
|
12
11
|
import { ReactEditor } from "slate-react";
|
|
13
12
|
import * as xstate_guards12 from "xstate/guards";
|
|
14
13
|
type MIMEType = `${string}/${string}`;
|
|
@@ -64,6 +63,54 @@ type Deserializer<TMIMEType extends MIMEType> = ({
|
|
|
64
63
|
snapshot: EditorSnapshot;
|
|
65
64
|
event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialize'>;
|
|
66
65
|
}) => PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialization.success' | 'deserialization.failure'>;
|
|
66
|
+
/**
|
|
67
|
+
* A segment in a path that identifies an element by its `_key` property.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
interface KeyedSegment {
|
|
71
|
+
_key: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A tuple representing a range selection, e.g., `[0, 5]` or `['', 3]`.
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
type IndexTuple = [number | '', number | ''];
|
|
78
|
+
/**
|
|
79
|
+
* A single segment in a path. Can be:
|
|
80
|
+
* - A string (property name)
|
|
81
|
+
* - A number (array index)
|
|
82
|
+
* - A KeyedSegment (object with `_key`)
|
|
83
|
+
* - An IndexTuple (range selection)
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
type PathSegment = string | number | KeyedSegment | IndexTuple;
|
|
87
|
+
/**
|
|
88
|
+
* A path is an array of path segments that describes a location in a document.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
type Path = PathSegment[];
|
|
92
|
+
/**
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
type BlockPath = [{
|
|
96
|
+
_key: string;
|
|
97
|
+
}];
|
|
98
|
+
/**
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
type AnnotationPath = [{
|
|
102
|
+
_key: string;
|
|
103
|
+
}, 'markDefs', {
|
|
104
|
+
_key: string;
|
|
105
|
+
}];
|
|
106
|
+
/**
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
type ChildPath = [{
|
|
110
|
+
_key: string;
|
|
111
|
+
}, 'children', {
|
|
112
|
+
_key: string;
|
|
113
|
+
}];
|
|
67
114
|
/**
|
|
68
115
|
* @public
|
|
69
116
|
*/
|
|
@@ -318,7 +365,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
318
365
|
*/
|
|
319
366
|
static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
|
|
320
367
|
static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
|
|
321
|
-
static findByPath: (editor: PortableTextEditor, path: Path) => [
|
|
368
|
+
static findByPath: (editor: PortableTextEditor, path: Path) => [_portabletext_schema12.PortableTextTextBlock<PortableTextObject | _portabletext_schema12.PortableTextSpan> | PortableTextObject | _portabletext_schema12.PortableTextSpan | undefined, Path | undefined];
|
|
322
369
|
/**
|
|
323
370
|
* @deprecated
|
|
324
371
|
* Use `editor.send(...)` instead
|
|
@@ -657,28 +704,6 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
657
704
|
* @group Components
|
|
658
705
|
*/
|
|
659
706
|
declare const PortableTextEditable: react18.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react18.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
660
|
-
/**
|
|
661
|
-
* @public
|
|
662
|
-
*/
|
|
663
|
-
type BlockPath = [{
|
|
664
|
-
_key: string;
|
|
665
|
-
}];
|
|
666
|
-
/**
|
|
667
|
-
* @public
|
|
668
|
-
*/
|
|
669
|
-
type AnnotationPath = [{
|
|
670
|
-
_key: string;
|
|
671
|
-
}, 'markDefs', {
|
|
672
|
-
_key: string;
|
|
673
|
-
}];
|
|
674
|
-
/**
|
|
675
|
-
* @public
|
|
676
|
-
*/
|
|
677
|
-
type ChildPath = [{
|
|
678
|
-
_key: string;
|
|
679
|
-
}, 'children', {
|
|
680
|
-
_key: string;
|
|
681
|
-
}];
|
|
682
707
|
/** @beta */
|
|
683
708
|
interface EditableAPIDeleteOptions {
|
|
684
709
|
mode?: 'blocks' | 'children' | 'selected';
|
|
@@ -1286,15 +1311,15 @@ type BlockOffset = {
|
|
|
1286
1311
|
path: BlockPath;
|
|
1287
1312
|
offset: number;
|
|
1288
1313
|
};
|
|
1289
|
-
type TextBlockWithOptionalKey = Omit<PortableTextTextBlock
|
|
1290
|
-
_key?: PortableTextTextBlock
|
|
1314
|
+
type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
|
|
1315
|
+
_key?: PortableTextTextBlock['_key'];
|
|
1291
1316
|
};
|
|
1292
|
-
type ObjectBlockWithOptionalKey = Omit<PortableTextObject
|
|
1293
|
-
_key?: PortableTextObject
|
|
1317
|
+
type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
1318
|
+
_key?: PortableTextObject['_key'];
|
|
1294
1319
|
};
|
|
1295
1320
|
type BlockWithOptionalKey = TextBlockWithOptionalKey | ObjectBlockWithOptionalKey;
|
|
1296
|
-
type SpanWithOptionalKey = Omit<PortableTextSpan
|
|
1297
|
-
_key?: PortableTextSpan
|
|
1321
|
+
type SpanWithOptionalKey = Omit<PortableTextSpan, '_key'> & {
|
|
1322
|
+
_key?: PortableTextSpan['_key'];
|
|
1298
1323
|
};
|
|
1299
1324
|
type ChildWithOptionalKey = SpanWithOptionalKey | ObjectBlockWithOptionalKey;
|
|
1300
1325
|
type EditorPriority = {
|
|
@@ -1937,7 +1962,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
1937
1962
|
keyGenerator: () => string;
|
|
1938
1963
|
pendingEvents: never[];
|
|
1939
1964
|
pendingIncomingPatchesEvents: never[];
|
|
1940
|
-
schema:
|
|
1965
|
+
schema: _portabletext_schema12.Schema;
|
|
1941
1966
|
selection: null;
|
|
1942
1967
|
initialReadOnly: boolean;
|
|
1943
1968
|
initialValue: PortableTextBlock[] | undefined;
|
|
@@ -3475,4 +3500,4 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
|
3475
3500
|
event: TBehaviorEvent;
|
|
3476
3501
|
dom: EditorDom;
|
|
3477
3502
|
}, guardResponse: TGuardResponse) => Array<BehaviorAction>;
|
|
3478
|
-
export { BlockAnnotationRenderProps as $,
|
|
3503
|
+
export { BlockAnnotationRenderProps as $, AnnotationPath as $t, PortableTextTextBlock$1 as A, ReadyChange as At, EditorSelector as B, ScrollSelectionIntoViewFunction as Bt, ListDefinition as C, OnPasteResultOrPromise as Ct, PortableTextChild$1 as D, PortableTextMemberSchemaTypes as Dt, PortableTextBlock$1 as E, PatchObservable as Et, BlockOffset as F, RenderDecoratorFunction as Ft, EditorConfig as G, PortableTextEditable as Gt, EditorProvider as H, UndoChange as Ht, useEditor as I, RenderEditableFunction as It, defineBehavior as J, PortableTextEditor as Jt, EditorEvent as K, PortableTextEditableProps as Kt, defaultKeyGenerator as L, RenderListItemFunction as Lt, StyleDefinition as M, RenderAnnotationFunction as Mt, StyleSchemaType as N, RenderBlockFunction as Nt, PortableTextObject$1 as O, RangeDecoration as Ot, defineSchema as P, RenderChildFunction as Pt, AddedAnnotationPaths as Q, EditorSchema as Qt, usePortableTextEditorSelection as R, RenderPlaceholderFunction as Rt, InlineObjectSchemaType as S, OnPasteResult as St, Patch$1 as T, PatchChange as Tt, EditorProviderProps as U, UnsetChange as Ut, useEditorSelector as V, SelectionChange as Vt, Editor as W, ValueChange as Wt, EditorContext as X, EditorEmittedEvent as Xt, BehaviorGuard as Y, PortableTextEditorProps as Yt, EditorSnapshot as Z, MutationEvent as Zt, BlockObjectSchemaType as _, LoadingChange as _t, forward as a, BlurChange as at, FieldDefinition as b, OnCopyFn as bt, CustomBehaviorEvent as c, EditableAPIDeleteOptions as ct, SyntheticBehaviorEvent as d, EditorSelection as dt, BlockPath as en, BlockChildRenderProps as et, PatchesEvent as f, EditorSelectionPoint as ft, BlockObjectDefinition as g, InvalidValueResolution as gt, BaseDefinition as h, InvalidValue as ht, execute as i, BlockStyleRenderProps as it, SchemaDefinition$1 as j, RedoChange as jt, PortableTextSpan$1 as k, RangeDecorationOnMovedDetails as kt, InsertPlacement as l, EditorChange as lt, AnnotationSchemaType as m, FocusChange as mt, BehaviorActionSet as n, KeyedSegment as nn, BlockListItemRenderProps as nt, raise as o, ConnectionChange as ot, AnnotationDefinition as p, ErrorChange as pt, Behavior as q, HotkeyOptions as qt, effect as r, BlockRenderProps as rt, BehaviorEvent as s, EditableAPI as st, BehaviorAction as t, ChildPath as tn, BlockDecoratorRenderProps as tt, NativeBehaviorEvent as u, EditorChanges as ut, DecoratorDefinition as v, MutationChange as vt, ListSchemaType as w, PasteData as wt, InlineObjectDefinition as x, OnPasteFn as xt, DecoratorSchemaType as y, OnBeforeInputFn as yt, usePortableTextEditor as z, RenderStyleFunction as zt };
|