@portabletext/editor 1.58.0 → 2.0.0-canary.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.
@@ -0,0 +1,3750 @@
1
+ import { Patch, Patch as Patch$1 } from "@portabletext/patches";
2
+ import * as _sanity_types5 from "@sanity/types";
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 xstate227 from "xstate";
5
+ import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
6
+ import { BaseRange, Descendant, Operation } from "slate";
7
+ import * as react22 from "react";
8
+ import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
9
+ import * as xstate_guards12 from "xstate/guards";
10
+ import { Observable, Subject } from "rxjs";
11
+ import { DOMNode } from "slate-dom";
12
+ import { ReactEditor } from "slate-react";
13
+ /**
14
+ * @internal
15
+ */
16
+ type PickFromUnion<TUnion, TTagKey extends keyof TUnion, TPickedTags extends TUnion[TTagKey]> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never;
17
+ /**
18
+ * @internal
19
+ */
20
+
21
+ type NamespaceEvent<TEvent, TNamespace extends string> = TEvent extends {
22
+ type: infer TEventType;
23
+ } ? { [K in keyof TEvent]: K extends 'type' ? `${TNamespace}.${TEventType & string}` : TEvent[K] } : never;
24
+ type StrictExtract<T, U extends T> = U;
25
+ type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
26
+ _key?: PortableTextTextBlock['_key'];
27
+ };
28
+ type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
29
+ _key?: PortableTextObject['_key'];
30
+ };
31
+ type BlockWithOptionalKey = TextBlockWithOptionalKey | ObjectBlockWithOptionalKey;
32
+ type MIMEType = `${string}/${string}`;
33
+ type EditorPriority = {
34
+ id: string;
35
+ name?: string;
36
+ reference?: {
37
+ priority: EditorPriority;
38
+ importance: 'higher' | 'lower';
39
+ };
40
+ };
41
+ type BehaviorConfig = {
42
+ behavior: Behavior;
43
+ priority: EditorPriority;
44
+ };
45
+ /**
46
+ * @public
47
+ */
48
+ type AddedAnnotationPaths = {
49
+ /**
50
+ * @deprecated An annotation may be applied to multiple blocks, resulting
51
+ * in multiple `markDef`'s being created. Use `markDefPaths` instead.
52
+ */
53
+ markDefPath: Path;
54
+ markDefPaths: Array<Path>;
55
+ /**
56
+ * @deprecated Does not return anything meaningful since an annotation
57
+ * can span multiple blocks and spans. If references the span closest
58
+ * to the focus point of the selection.
59
+ */
60
+ spanPath: Path;
61
+ };
62
+ /**
63
+ * @public
64
+ */
65
+ type EditorEmittedEvent = {
66
+ type: 'blurred';
67
+ event: FocusEvent<HTMLDivElement, Element>;
68
+ } | {
69
+ /**
70
+ * @deprecated Will be removed in the next major version
71
+ */
72
+ type: 'done loading';
73
+ } | {
74
+ type: 'editable';
75
+ } | ErrorEvent | {
76
+ type: 'focused';
77
+ event: FocusEvent<HTMLDivElement, Element>;
78
+ } | {
79
+ type: 'invalid value';
80
+ resolution: InvalidValueResolution | null;
81
+ value: Array<PortableTextBlock> | undefined;
82
+ } | {
83
+ /**
84
+ * @deprecated Will be removed in the next major version
85
+ */
86
+ type: 'loading';
87
+ } | MutationEvent | PatchEvent | {
88
+ type: 'read only';
89
+ } | {
90
+ type: 'ready';
91
+ } | {
92
+ type: 'selection';
93
+ selection: EditorSelection;
94
+ } | {
95
+ type: 'value changed';
96
+ value: Array<PortableTextBlock> | undefined;
97
+ };
98
+ /**
99
+ * @deprecated The event is no longer emitted
100
+ */
101
+ type ErrorEvent = {
102
+ type: 'error';
103
+ name: string;
104
+ description: string;
105
+ data: unknown;
106
+ };
107
+ /**
108
+ * @public
109
+ */
110
+ type MutationEvent = {
111
+ type: 'mutation';
112
+ patches: Array<Patch>;
113
+ /**
114
+ * @deprecated Use `value` instead
115
+ */
116
+ snapshot: Array<PortableTextBlock> | undefined;
117
+ value: Array<PortableTextBlock> | undefined;
118
+ };
119
+ type PatchEvent = {
120
+ type: 'patch';
121
+ patch: Patch;
122
+ };
123
+ type SlateEditor = {
124
+ instance: PortableTextSlateEditor;
125
+ initialValue: Array<Descendant>;
126
+ };
127
+ /**
128
+ * @public
129
+ */
130
+ type BaseDefinition = {
131
+ name: string;
132
+ title?: string;
133
+ };
134
+ /**
135
+ * @public
136
+ */
137
+ type FieldDefinition = BaseDefinition & {
138
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
139
+ };
140
+ /**
141
+ * @public
142
+ */
143
+ type DecoratorDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition;
144
+ /**
145
+ * @public
146
+ */
147
+ type AnnotationDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition & {
148
+ fields?: ReadonlyArray<FieldDefinition>;
149
+ };
150
+ /**
151
+ * @public
152
+ */
153
+ type BlockObjectDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition & {
154
+ fields?: ReadonlyArray<FieldDefinition>;
155
+ };
156
+ /**
157
+ * @public
158
+ */
159
+ type InlineObjectDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition & {
160
+ fields?: ReadonlyArray<FieldDefinition>;
161
+ };
162
+ /**
163
+ * @public
164
+ */
165
+ type ListDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition;
166
+ /**
167
+ * @public
168
+ */
169
+ type StyleDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = TBaseDefinition;
170
+ /**
171
+ * @public
172
+ */
173
+ type SchemaDefinition<TBaseDefinition extends BaseDefinition = BaseDefinition> = {
174
+ decorators?: ReadonlyArray<DecoratorDefinition<TBaseDefinition>>;
175
+ blockObjects?: ReadonlyArray<BlockObjectDefinition<TBaseDefinition>>;
176
+ inlineObjects?: ReadonlyArray<InlineObjectDefinition<TBaseDefinition>>;
177
+ annotations?: ReadonlyArray<AnnotationDefinition<TBaseDefinition>>;
178
+ lists?: ReadonlyArray<ListDefinition<TBaseDefinition>>;
179
+ styles?: ReadonlyArray<StyleDefinition<TBaseDefinition>>;
180
+ };
181
+ /**
182
+ * @public
183
+ * A helper wrapper that adds editor support, such as autocomplete and type checking, for a schema definition.
184
+ * @example
185
+ * ```ts
186
+ * import { defineSchema } from '@portabletext/editor'
187
+ *
188
+ * const schemaDefinition = defineSchema({
189
+ * decorators: [{name: 'strong'}, {name: 'em'}, {name: 'underline'}],
190
+ * annotations: [{name: 'link'}],
191
+ * styles: [
192
+ * {name: 'normal'},
193
+ * {name: 'h1'},
194
+ * {name: 'h2'},
195
+ * {name: 'h3'},
196
+ * {name: 'blockquote'},
197
+ * ],
198
+ * lists: [],
199
+ * inlineObjects: [],
200
+ * blockObjects: [],
201
+ * }
202
+ * ```
203
+ */
204
+ declare function defineSchema<const TSchemaDefinition extends SchemaDefinition>(definition: TSchemaDefinition): TSchemaDefinition;
205
+ /**
206
+ * @public
207
+ */
208
+ type EditorSchema = {
209
+ annotations: ReadonlyArray<AnnotationSchemaType>;
210
+ block: {
211
+ name: string;
212
+ };
213
+ blockObjects: ReadonlyArray<BlockObjectSchemaType>;
214
+ decorators: ReadonlyArray<DecoratorSchemaType>;
215
+ inlineObjects: ReadonlyArray<InlineObjectSchemaType>;
216
+ span: {
217
+ name: string;
218
+ };
219
+ styles: ReadonlyArray<StyleSchemaType>;
220
+ lists: ReadonlyArray<ListSchemaType>;
221
+ };
222
+ /**
223
+ * @public
224
+ */
225
+ type AnnotationSchemaType = BaseDefinition & {
226
+ fields: ReadonlyArray<FieldDefinition>;
227
+ };
228
+ /**
229
+ * @public
230
+ */
231
+ type BlockObjectSchemaType = BaseDefinition & {
232
+ fields: ReadonlyArray<FieldDefinition>;
233
+ };
234
+ /**
235
+ * @public
236
+ */
237
+ type DecoratorSchemaType = BaseDefinition & {
238
+ /**
239
+ * @deprecated
240
+ * Use `name` instead
241
+ */
242
+ value: string;
243
+ };
244
+ /**
245
+ * @public
246
+ */
247
+ type InlineObjectSchemaType = BaseDefinition & {
248
+ fields: ReadonlyArray<FieldDefinition>;
249
+ };
250
+ /**
251
+ * @public
252
+ */
253
+ type ListSchemaType = BaseDefinition & {
254
+ /**
255
+ * @deprecated
256
+ * Use `name` instead
257
+ */
258
+ value: string;
259
+ };
260
+ /**
261
+ * @public
262
+ */
263
+ type StyleSchemaType = BaseDefinition & {
264
+ /**
265
+ * @deprecated
266
+ * Use `name` instead
267
+ */
268
+ value: string;
269
+ };
270
+ type InternalEditor = Editor & {
271
+ _internal: {
272
+ editable: EditableAPI;
273
+ editorActor: EditorActor;
274
+ slateEditor: SlateEditor;
275
+ };
276
+ };
277
+ /**
278
+ * Props for the PortableTextEditor component
279
+ *
280
+ * @public
281
+ * @deprecated Use `EditorProvider` instead
282
+ */
283
+ type PortableTextEditorProps<TEditor extends InternalEditor | undefined = undefined> = PropsWithChildren<TEditor extends InternalEditor ? {
284
+ /**
285
+ * @internal
286
+ */
287
+ editor: TEditor;
288
+ } : {
289
+ editor?: undefined;
290
+ /**
291
+ * Function that gets called when the editor changes the value
292
+ */
293
+ onChange: (change: EditorChange) => void;
294
+ /**
295
+ * Schema type for the portable text field
296
+ */
297
+ schemaType: ArraySchemaType<PortableTextBlock> | ArrayDefinition;
298
+ /**
299
+ * Maximum number of blocks to allow within the editor
300
+ */
301
+ maxBlocks?: number | string;
302
+ /**
303
+ * Function used to generate keys for array items (`_key`)
304
+ */
305
+ keyGenerator?: () => string;
306
+ /**
307
+ * Observable of local and remote patches for the edited value.
308
+ */
309
+ patches$?: PatchObservable;
310
+ /**
311
+ * Backward compatibility (renamed to patches$).
312
+ */
313
+ incomingPatches$?: PatchObservable;
314
+ /**
315
+ * Whether or not the editor should be in read-only mode
316
+ */
317
+ readOnly?: boolean;
318
+ /**
319
+ * The current value of the portable text field
320
+ */
321
+ value?: PortableTextBlock[];
322
+ /**
323
+ * A ref to the editor instance
324
+ */
325
+ editorRef?: MutableRefObject<PortableTextEditor | null>;
326
+ }>;
327
+ /**
328
+ * The main Portable Text Editor component.
329
+ * @public
330
+ * @deprecated Use `EditorProvider` instead
331
+ */
332
+ declare class PortableTextEditor extends Component<PortableTextEditorProps<InternalEditor | undefined>> {
333
+ static displayName: string;
334
+ /**
335
+ * An observable of all the editor changes.
336
+ */
337
+ change$: EditorChanges;
338
+ /**
339
+ * A lookup table for all the relevant schema types for this portable text type.
340
+ */
341
+ schemaTypes: PortableTextMemberSchemaTypes;
342
+ /**
343
+ * The editor instance
344
+ */
345
+ private editor;
346
+ private editable;
347
+ private actors?;
348
+ private subscriptions;
349
+ private unsubscribers;
350
+ constructor(props: PortableTextEditorProps);
351
+ componentDidMount(): void;
352
+ componentDidUpdate(prevProps: PortableTextEditorProps): void;
353
+ componentWillUnmount(): void;
354
+ setEditable: (editable: EditableAPI) => void;
355
+ render(): react22.JSX.Element;
356
+ /**
357
+ * @deprecated
358
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
359
+ *
360
+ * ```
361
+ * import * as selectors from '@portabletext/editor/selectors'
362
+ * const editor = useEditor()
363
+ * const isActive = useEditorSelector(editor, selectors.getActiveAnnotations)
364
+ * ```
365
+ */
366
+ static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[];
367
+ /**
368
+ * @deprecated
369
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
370
+ *
371
+ * ```
372
+ * import * as selectors from '@portabletext/editor/selectors'
373
+ * const editor = useEditor()
374
+ * const isActive = useEditorSelector(editor, selectors.isActiveAnnotation(...))
375
+ * ```
376
+ */
377
+ static isAnnotationActive: (editor: PortableTextEditor, annotationType: PortableTextObject["_type"]) => boolean;
378
+ /**
379
+ * @deprecated
380
+ * Use `editor.send(...)` instead
381
+ *
382
+ * ```
383
+ * const editor = useEditor()
384
+ * editor.send({
385
+ * type: 'annotation.add',
386
+ * annotation: {
387
+ * name: '...',
388
+ * value: {...},
389
+ * }
390
+ * })
391
+ * ```
392
+ */
393
+ static addAnnotation: <TSchemaType extends {
394
+ name: string;
395
+ }>(editor: PortableTextEditor, type: TSchemaType, value?: {
396
+ [prop: string]: unknown;
397
+ }) => AddedAnnotationPaths | undefined;
398
+ /**
399
+ * @deprecated
400
+ * Use `editor.send(...)` instead
401
+ *
402
+ * ```
403
+ * const editor = useEditor()
404
+ * editor.send({
405
+ * type: 'blur',
406
+ * })
407
+ * ```
408
+ */
409
+ static blur: (editor: PortableTextEditor) => void;
410
+ static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
411
+ static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
412
+ static findByPath: (editor: PortableTextEditor, path: Path) => [_sanity_types5.PortableTextTextBlock<PortableTextObject | _sanity_types5.PortableTextSpan> | PortableTextObject | _sanity_types5.PortableTextSpan | undefined, Path | undefined];
413
+ /**
414
+ * @deprecated
415
+ * Use `editor.send(...)` instead
416
+ *
417
+ * ```
418
+ * const editor = useEditor()
419
+ * editor.send({
420
+ * type: 'focus',
421
+ * })
422
+ * ```
423
+ */
424
+ static focus: (editor: PortableTextEditor) => void;
425
+ /**
426
+ * @deprecated
427
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
428
+ *
429
+ * ```
430
+ * import * as selectors from '@portabletext/editor/selectors'
431
+ * const editor = useEditor()
432
+ * const focusBlock = useEditorSelector(editor, selectors.getFocusBlock)
433
+ * ```
434
+ */
435
+ static focusBlock: (editor: PortableTextEditor) => PortableTextBlock | undefined;
436
+ /**
437
+ * @deprecated
438
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
439
+ *
440
+ * ```
441
+ * import * as selectors from '@portabletext/editor/selectors'
442
+ * const editor = useEditor()
443
+ * const focusChild = useEditorSelector(editor, selectors.getFocusChild)
444
+ * ```
445
+ */
446
+ static focusChild: (editor: PortableTextEditor) => PortableTextChild | undefined;
447
+ /**
448
+ * @deprecated
449
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
450
+ *
451
+ * ```
452
+ * import * as selectors from '@portabletext/editor/selectors'
453
+ * const editor = useEditor()
454
+ * const selection = useEditorSelector(editor, selectors.getSelection)
455
+ * ```
456
+ */
457
+ static getSelection: (editor: PortableTextEditor) => EditorSelection;
458
+ /**
459
+ * @deprecated
460
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
461
+ *
462
+ * ```
463
+ * import * as selectors from '@portabletext/editor/selectors'
464
+ * const editor = useEditor()
465
+ * const value = useEditorSelector(editor, selectors.getValue)
466
+ * ```
467
+ */
468
+ static getValue: (editor: PortableTextEditor) => PortableTextBlock[] | undefined;
469
+ /**
470
+ * @deprecated
471
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
472
+ *
473
+ * ```
474
+ * import * as selectors from '@portabletext/editor/selectors'
475
+ * const editor = useEditor()
476
+ * const isActive = useEditorSelector(editor, selectors.isActiveStyle(...))
477
+ * ```
478
+ */
479
+ static hasBlockStyle: (editor: PortableTextEditor, blockStyle: string) => boolean;
480
+ /**
481
+ * @deprecated
482
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
483
+ *
484
+ * ```
485
+ * import * as selectors from '@portabletext/editor/selectors'
486
+ * const editor = useEditor()
487
+ * const isActive = useEditorSelector(editor, selectors.isActiveListItem(...))
488
+ * ```
489
+ */
490
+ static hasListStyle: (editor: PortableTextEditor, listStyle: string) => boolean;
491
+ /**
492
+ * @deprecated
493
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
494
+ *
495
+ * ```
496
+ * import * as selectors from '@portabletext/editor/selectors'
497
+ * const editor = useEditor()
498
+ * const isSelectionCollapsed = useEditorSelector(editor, selectors.isSelectionCollapsed)
499
+ * ```
500
+ */
501
+ static isCollapsedSelection: (editor: PortableTextEditor) => boolean;
502
+ /**
503
+ * @deprecated
504
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
505
+ *
506
+ * ```
507
+ * import * as selectors from '@portabletext/editor/selectors'
508
+ * const editor = useEditor()
509
+ * const isSelectionExpanded = useEditorSelector(editor, selectors.isSelectionExpanded)
510
+ * ```
511
+ */
512
+ static isExpandedSelection: (editor: PortableTextEditor) => boolean;
513
+ /**
514
+ * @deprecated
515
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
516
+ *
517
+ * ```
518
+ * import * as selectors from '@portabletext/editor/selectors'
519
+ * const editor = useEditor()
520
+ * const isActive = useEditorSelector(editor, selectors.isActiveDecorator(...))
521
+ * ```
522
+ */
523
+ static isMarkActive: (editor: PortableTextEditor, mark: string) => boolean;
524
+ /**
525
+ * @deprecated
526
+ * Use `editor.send(...)` instead
527
+ *
528
+ * ```
529
+ * const editor = useEditor()
530
+ * editor.send({
531
+ * type: 'insert.span',
532
+ * text: '...',
533
+ * annotations: [{name: '...', value: {...}}],
534
+ * decorators: ['...'],
535
+ * })
536
+ * editor.send({
537
+ * type: 'insert.inline object',
538
+ * inlineObject: {
539
+ * name: '...',
540
+ * value: {...},
541
+ * },
542
+ * })
543
+ * ```
544
+ */
545
+ static insertChild: <TSchemaType extends {
546
+ name: string;
547
+ }>(editor: PortableTextEditor, type: TSchemaType, value?: {
548
+ [prop: string]: unknown;
549
+ }) => Path | undefined;
550
+ /**
551
+ * @deprecated
552
+ * Use `editor.send(...)` instead
553
+ *
554
+ * ```
555
+ * const editor = useEditor()
556
+ * editor.send({
557
+ * type: 'insert.block object',
558
+ * blockObject: {
559
+ * name: '...',
560
+ * value: {...},
561
+ * },
562
+ * placement: 'auto' | 'after' | 'before',
563
+ * })
564
+ * ```
565
+ */
566
+ static insertBlock: <TSchemaType extends {
567
+ name: string;
568
+ }>(editor: PortableTextEditor, type: TSchemaType, value?: {
569
+ [prop: string]: unknown;
570
+ }) => Path | undefined;
571
+ /**
572
+ * @deprecated
573
+ * Use `editor.send(...)` instead
574
+ *
575
+ * ```
576
+ * const editor = useEditor()
577
+ * editor.send({
578
+ * type: 'insert.break',
579
+ * })
580
+ * ```
581
+ */
582
+ static insertBreak: (editor: PortableTextEditor) => void;
583
+ static isVoid: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => boolean;
584
+ static isObjectPath: (_editor: PortableTextEditor, path: Path) => boolean;
585
+ static marks: (editor: PortableTextEditor) => string[];
586
+ /**
587
+ * @deprecated
588
+ * Use `editor.send(...)` instead
589
+ *
590
+ * ```
591
+ * const editor = useEditor()
592
+ * editor.send({
593
+ * type: 'select',
594
+ * selection: {...},
595
+ * })
596
+ * ```
597
+ */
598
+ static select: (editor: PortableTextEditor, selection: EditorSelection | null) => void;
599
+ /**
600
+ * @deprecated
601
+ * Use `editor.send(...)` instead
602
+ *
603
+ * ```
604
+ * const editor = useEditor()
605
+ * editor.send({
606
+ * type: 'annotation.remove',
607
+ * annotation: {
608
+ * name: '...',
609
+ * },
610
+ * })
611
+ * ```
612
+ */
613
+ static removeAnnotation: <TSchemaType extends {
614
+ name: string;
615
+ }>(editor: PortableTextEditor, type: TSchemaType) => void;
616
+ /**
617
+ * @deprecated
618
+ * Use `editor.send(...)` instead
619
+ *
620
+ * ```
621
+ * const editor = useEditor()
622
+ * editor.send({
623
+ * type: 'style.toggle',
624
+ * style: '...',
625
+ * })
626
+ * ```
627
+ */
628
+ static toggleBlockStyle: (editor: PortableTextEditor, blockStyle: string) => void;
629
+ /**
630
+ * @deprecated
631
+ * Use `editor.send(...)` instead
632
+ *
633
+ * ```
634
+ * const editor = useEditor()
635
+ * editor.send({
636
+ * type: 'list item.toggle',
637
+ * listItem: '...',
638
+ * })
639
+ * ```
640
+ */
641
+ static toggleList: (editor: PortableTextEditor, listStyle: string) => void;
642
+ /**
643
+ * @deprecated
644
+ * Use `editor.send(...)` instead
645
+ *
646
+ * ```
647
+ * const editor = useEditor()
648
+ * editor.send({
649
+ * type: 'decorator.toggle',
650
+ * decorator: '...',
651
+ * })
652
+ * ```
653
+ */
654
+ static toggleMark: (editor: PortableTextEditor, mark: string) => void;
655
+ /**
656
+ * @deprecated
657
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
658
+ *
659
+ * ```
660
+ * import * as selectors from '@portabletext/editor/selectors'
661
+ * const editor = useEditor()
662
+ * const selectedSlice = useEditorSelector(editor, selectors.getSelectedSlice)
663
+ * ```
664
+ */
665
+ static getFragment: (editor: PortableTextEditor) => PortableTextBlock[] | undefined;
666
+ /**
667
+ * @deprecated
668
+ * Use `editor.send(...)` instead
669
+ *
670
+ * ```
671
+ * const editor = useEditor()
672
+ * editor.send({
673
+ * type: 'history.undo',
674
+ * })
675
+ * ```
676
+ */
677
+ static undo: (editor: PortableTextEditor) => void;
678
+ /**
679
+ * @deprecated
680
+ * Use `editor.send(...)` instead
681
+ *
682
+ * ```
683
+ * const editor = useEditor()
684
+ * editor.send({
685
+ * type: 'history.redo',
686
+ * })
687
+ * ```
688
+ */
689
+ static redo: (editor: PortableTextEditor) => void;
690
+ /**
691
+ * @deprecated
692
+ * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
693
+ *
694
+ * ```
695
+ * import * as selectors from '@portabletext/editor/selectors'
696
+ * const editor = useEditor()
697
+ * const isOverlapping = useEditorSelector(editor, selectors.isOverlappingSelection(selectionB))
698
+ * ```
699
+ */
700
+ static isSelectionsOverlapping: (editor: PortableTextEditor, selectionA: EditorSelection, selectionB: EditorSelection) => boolean;
701
+ }
702
+ /**
703
+ * @beta
704
+ */
705
+ type HotkeyOptions = {
706
+ marks?: Record<string, string>;
707
+ custom?: Record<string, (event: BaseSyntheticEvent, editor: PortableTextEditor) => void>;
708
+ };
709
+ /**
710
+ * @public
711
+ */
712
+ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'onPaste' | 'onCopy' | 'onBeforeInput'> & {
713
+ hotkeys?: HotkeyOptions;
714
+ onBeforeInput?: (event: InputEvent) => void;
715
+ onPaste?: OnPasteFn;
716
+ onCopy?: OnCopyFn;
717
+ ref: MutableRefObject<HTMLDivElement | null>;
718
+ rangeDecorations?: RangeDecoration[];
719
+ renderAnnotation?: RenderAnnotationFunction;
720
+ renderBlock?: RenderBlockFunction;
721
+ renderChild?: RenderChildFunction;
722
+ renderDecorator?: RenderDecoratorFunction;
723
+ renderListItem?: RenderListItemFunction;
724
+ renderPlaceholder?: RenderPlaceholderFunction;
725
+ renderStyle?: RenderStyleFunction;
726
+ scrollSelectionIntoView?: ScrollSelectionIntoViewFunction;
727
+ selection?: EditorSelection;
728
+ spellCheck?: boolean;
729
+ };
730
+ /**
731
+ * @public
732
+ *
733
+ *
734
+ * The core component that renders the editor. Must be placed within the {@link EditorProvider} component.
735
+ *
736
+ * @example
737
+ * ```tsx
738
+ * import { PortableTextEditable, EditorProvider } from '@portabletext/editor'
739
+ *
740
+ * function MyComponent() {
741
+ * return (
742
+ * <EditorProvider>
743
+ * <PortableTextEditable />
744
+ * </EditorProvider>
745
+ * )
746
+ * }
747
+ * ```
748
+ * @group Components
749
+ */
750
+ declare const PortableTextEditable: react22.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react22.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
751
+ type DecoratedRange = BaseRange & {
752
+ rangeDecoration: RangeDecoration;
753
+ };
754
+ /**
755
+ * @public
756
+ */
757
+ type BlockPath = [{
758
+ _key: string;
759
+ }];
760
+ /**
761
+ * @public
762
+ */
763
+ type AnnotationPath = [{
764
+ _key: string;
765
+ }, 'markDefs', {
766
+ _key: string;
767
+ }];
768
+ /**
769
+ * @public
770
+ */
771
+ type ChildPath = [{
772
+ _key: string;
773
+ }, 'children', {
774
+ _key: string;
775
+ }];
776
+ /** @beta */
777
+ interface EditableAPIDeleteOptions {
778
+ mode?: 'blocks' | 'children' | 'selected';
779
+ }
780
+ /** @beta */
781
+ interface EditableAPI {
782
+ activeAnnotations: () => PortableTextObject[];
783
+ isAnnotationActive: (annotationType: PortableTextObject['_type']) => boolean;
784
+ addAnnotation: <TSchemaType extends {
785
+ name: string;
786
+ }>(type: TSchemaType, value?: {
787
+ [prop: string]: unknown;
788
+ }) => {
789
+ markDefPath: Path;
790
+ markDefPaths: Array<Path>;
791
+ spanPath: Path;
792
+ } | undefined;
793
+ blur: () => void;
794
+ delete: (selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
795
+ findByPath: (path: Path) => [PortableTextBlock | PortableTextChild | undefined, Path | undefined];
796
+ findDOMNode: (element: PortableTextBlock | PortableTextChild) => DOMNode | undefined;
797
+ focus: () => void;
798
+ focusBlock: () => PortableTextBlock | undefined;
799
+ focusChild: () => PortableTextChild | undefined;
800
+ getSelection: () => EditorSelection;
801
+ getFragment: () => PortableTextBlock[] | undefined;
802
+ getValue: () => PortableTextBlock[] | undefined;
803
+ hasBlockStyle: (style: string) => boolean;
804
+ hasListStyle: (listStyle: string) => boolean;
805
+ insertBlock: <TSchemaType extends {
806
+ name: string;
807
+ }>(type: TSchemaType, value?: {
808
+ [prop: string]: unknown;
809
+ }) => Path;
810
+ insertChild: <TSchemaType extends {
811
+ name: string;
812
+ }>(type: TSchemaType, value?: {
813
+ [prop: string]: unknown;
814
+ }) => Path;
815
+ insertBreak: () => void;
816
+ isCollapsedSelection: () => boolean;
817
+ isExpandedSelection: () => boolean;
818
+ isMarkActive: (mark: string) => boolean;
819
+ isSelectionsOverlapping: (selectionA: EditorSelection, selectionB: EditorSelection) => boolean;
820
+ isVoid: (element: PortableTextBlock | PortableTextChild) => boolean;
821
+ marks: () => string[];
822
+ redo: () => void;
823
+ removeAnnotation: <TSchemaType extends {
824
+ name: string;
825
+ }>(type: TSchemaType) => void;
826
+ select: (selection: EditorSelection) => void;
827
+ toggleBlockStyle: (blockStyle: string) => void;
828
+ toggleList: (listStyle: string) => void;
829
+ toggleMark: (mark: string) => void;
830
+ undo: () => void;
831
+ }
832
+ type HistoryItem = {
833
+ operations: Operation[];
834
+ timestamp: Date;
835
+ };
836
+ interface History {
837
+ redos: HistoryItem[];
838
+ undos: HistoryItem[];
839
+ }
840
+ /** @public */
841
+ type EditorSelectionPoint = {
842
+ path: Path;
843
+ offset: number;
844
+ };
845
+ /** @public */
846
+ type EditorSelection = {
847
+ anchor: EditorSelectionPoint;
848
+ focus: EditorSelectionPoint;
849
+ backward?: boolean;
850
+ } | null;
851
+ interface PortableTextSlateEditor extends ReactEditor {
852
+ _key: 'editor';
853
+ _type: 'editor';
854
+ createPlaceholderBlock: () => Descendant;
855
+ editable: EditableAPI;
856
+ history: History;
857
+ insertPortableTextData: (data: DataTransfer) => boolean;
858
+ insertTextOrHTMLData: (data: DataTransfer) => boolean;
859
+ isTextBlock: (value: unknown) => value is PortableTextTextBlock;
860
+ isTextSpan: (value: unknown) => value is PortableTextSpan;
861
+ isListBlock: (value: unknown) => value is PortableTextListBlock;
862
+ value: Array<PortableTextBlock>;
863
+ decoratedRanges: Array<DecoratedRange>;
864
+ decoratorState: Record<string, boolean | undefined>;
865
+ blockIndexMap: Map<string, number>;
866
+ listIndexMap: Map<string, number>;
867
+ /**
868
+ * Use hotkeys
869
+ */
870
+ pteWithHotKeys: (event: KeyboardEvent$1<HTMLDivElement>) => void;
871
+ /**
872
+ * Helper function that creates a text block
873
+ */
874
+ pteCreateTextBlock: (options: {
875
+ decorators: Array<string>;
876
+ listItem?: string;
877
+ level?: number;
878
+ }) => Descendant;
879
+ /**
880
+ * Undo
881
+ */
882
+ undo: () => void;
883
+ /**
884
+ * Redo
885
+ */
886
+ redo: () => void;
887
+ }
888
+ /**
889
+ * The editor has mutated it's content.
890
+ * @beta */
891
+ type MutationChange = {
892
+ type: 'mutation';
893
+ patches: Patch[];
894
+ snapshot: PortableTextBlock[] | undefined;
895
+ };
896
+ /**
897
+ * The editor has produced a patch
898
+ * @beta */
899
+ type PatchChange = {
900
+ type: 'patch';
901
+ patch: Patch;
902
+ };
903
+ /**
904
+ * The editor has received a new (props) value
905
+ * @beta */
906
+ type ValueChange = {
907
+ type: 'value';
908
+ value: PortableTextBlock[] | undefined;
909
+ };
910
+ /**
911
+ * The editor has a new selection
912
+ * @beta */
913
+ type SelectionChange = {
914
+ type: 'selection';
915
+ selection: EditorSelection;
916
+ };
917
+ /**
918
+ * The editor received focus
919
+ * @beta */
920
+ type FocusChange = {
921
+ type: 'focus';
922
+ event: FocusEvent<HTMLDivElement, Element>;
923
+ };
924
+ /**
925
+ * @beta
926
+ * @deprecated Use `'patch'` changes instead
927
+ */
928
+ type UnsetChange = {
929
+ type: 'unset';
930
+ previousValue: PortableTextBlock[];
931
+ };
932
+ /**
933
+ * The editor blurred
934
+ * @beta */
935
+ type BlurChange = {
936
+ type: 'blur';
937
+ event: FocusEvent<HTMLDivElement, Element>;
938
+ };
939
+ /**
940
+ * The editor is currently loading something
941
+ * Could be used to show a spinner etc.
942
+ * @beta
943
+ * @deprecated Will be removed in the next major version
944
+ */
945
+ type LoadingChange = {
946
+ type: 'loading';
947
+ isLoading: boolean;
948
+ };
949
+ /**
950
+ * The editor content is ready to be edited by the user
951
+ * @beta */
952
+ type ReadyChange = {
953
+ type: 'ready';
954
+ };
955
+ /**
956
+ * The editor produced an error
957
+ * @beta
958
+ * @deprecated The change is no longer emitted
959
+ * */
960
+ type ErrorChange = {
961
+ type: 'error';
962
+ name: string;
963
+ level: 'warning' | 'error';
964
+ description: string;
965
+ data?: unknown;
966
+ };
967
+ /**
968
+ * The editor has invalid data in the value that can be resolved by the user
969
+ * @beta */
970
+ type InvalidValueResolution = {
971
+ autoResolve?: boolean;
972
+ patches: Patch[];
973
+ description: string;
974
+ action: string;
975
+ item: PortableTextBlock[] | PortableTextBlock | PortableTextChild | undefined;
976
+ /**
977
+ * i18n keys for the description and action
978
+ *
979
+ * These are in addition to the description and action properties, to decouple the editor from
980
+ * the i18n system, and allow usage without it. The i18n keys take precedence over the
981
+ * description and action properties, if i18n framework is available.
982
+ */
983
+ i18n: {
984
+ description: `inputs.portable-text.invalid-value.${Lowercase<string>}.description`;
985
+ action: `inputs.portable-text.invalid-value.${Lowercase<string>}.action`;
986
+ values?: Record<string, string | number | string[]>;
987
+ };
988
+ };
989
+ /**
990
+ * The editor has an invalid value
991
+ * @beta */
992
+ type InvalidValue = {
993
+ type: 'invalidValue';
994
+ resolution: InvalidValueResolution | null;
995
+ value: PortableTextBlock[] | undefined;
996
+ };
997
+ /**
998
+ * The editor performed a undo history step
999
+ * @beta
1000
+ * @deprecated The change is no longer emitted
1001
+ * */
1002
+ type UndoChange = {
1003
+ type: 'undo';
1004
+ patches: Patch[];
1005
+ timestamp: Date;
1006
+ };
1007
+ /**
1008
+ * The editor performed redo history step
1009
+ * @beta
1010
+ * @deprecated The change is no longer emitted
1011
+ * */
1012
+ type RedoChange = {
1013
+ type: 'redo';
1014
+ patches: Patch[];
1015
+ timestamp: Date;
1016
+ };
1017
+ /**
1018
+ * The editor was either connected or disconnected to the network
1019
+ * To show out of sync warnings etc when in collaborative mode.
1020
+ * @beta
1021
+ * @deprecated The change is no longer emitted
1022
+ * */
1023
+ type ConnectionChange = {
1024
+ type: 'connection';
1025
+ value: 'online' | 'offline';
1026
+ };
1027
+ /**
1028
+ * When the editor changes, it will emit a change item describing the change
1029
+ * @beta */
1030
+ type EditorChange = BlurChange | ConnectionChange | ErrorChange | FocusChange | InvalidValue | LoadingChange | MutationChange | PatchChange | ReadyChange | RedoChange | SelectionChange | UndoChange | UnsetChange | ValueChange;
1031
+ /**
1032
+ * @beta
1033
+ */
1034
+ type EditorChanges = Subject<EditorChange>;
1035
+ /** @beta */
1036
+ type OnPasteResult = {
1037
+ insert?: TypedObject[];
1038
+ path?: Path;
1039
+ } | undefined;
1040
+ /**
1041
+ * @beta
1042
+ */
1043
+ type OnPasteResultOrPromise = OnPasteResult | Promise<OnPasteResult>;
1044
+ /** @beta */
1045
+ interface PasteData {
1046
+ event: ClipboardEvent;
1047
+ path: Path;
1048
+ schemaTypes: PortableTextMemberSchemaTypes;
1049
+ value: PortableTextBlock[] | undefined;
1050
+ }
1051
+ /**
1052
+ * @beta
1053
+ * It is encouraged not to return `Promise<undefined>` from the `OnPasteFn` as
1054
+ * a mechanism to fall back to the native paste behaviour. This doesn't work in
1055
+ * all cases. Always return plain `undefined` if possible.
1056
+ **/
1057
+ type OnPasteFn = (data: PasteData) => OnPasteResultOrPromise;
1058
+ /** @beta */
1059
+ type OnBeforeInputFn = (event: InputEvent) => void;
1060
+ /** @beta */
1061
+ type OnCopyFn = (event: ClipboardEvent<HTMLDivElement | HTMLSpanElement>) => undefined | unknown;
1062
+ /** @beta */
1063
+ type PatchObservable = Observable<{
1064
+ patches: Patch[];
1065
+ snapshot: PortableTextBlock[] | undefined;
1066
+ }>;
1067
+ /** @beta */
1068
+ interface BlockRenderProps {
1069
+ children: ReactElement<any>;
1070
+ editorElementRef: RefObject<HTMLElement | null>;
1071
+ focused: boolean;
1072
+ level?: number;
1073
+ listItem?: string;
1074
+ path: BlockPath;
1075
+ selected: boolean;
1076
+ style?: string;
1077
+ schemaType: ObjectSchemaType;
1078
+ /** @deprecated Use `schemaType` instead */
1079
+ type: ObjectSchemaType;
1080
+ value: PortableTextBlock;
1081
+ }
1082
+ /** @beta */
1083
+ interface BlockChildRenderProps {
1084
+ annotations: PortableTextObject[];
1085
+ children: ReactElement<any>;
1086
+ editorElementRef: RefObject<HTMLElement | null>;
1087
+ focused: boolean;
1088
+ path: Path;
1089
+ selected: boolean;
1090
+ schemaType: ObjectSchemaType;
1091
+ /** @deprecated Use `schemaType` instead */
1092
+ type: ObjectSchemaType;
1093
+ value: PortableTextChild;
1094
+ }
1095
+ /** @beta */
1096
+ interface BlockAnnotationRenderProps {
1097
+ block: PortableTextBlock;
1098
+ children: ReactElement<any>;
1099
+ editorElementRef: RefObject<HTMLElement | null>;
1100
+ focused: boolean;
1101
+ path: Path;
1102
+ schemaType: ObjectSchemaType;
1103
+ selected: boolean;
1104
+ /** @deprecated Use `schemaType` instead */
1105
+ type: ObjectSchemaType;
1106
+ value: PortableTextObject;
1107
+ }
1108
+ /** @beta */
1109
+ interface BlockDecoratorRenderProps {
1110
+ children: ReactElement<any>;
1111
+ editorElementRef: RefObject<HTMLElement | null>;
1112
+ focused: boolean;
1113
+ path: Path;
1114
+ schemaType: BlockDecoratorDefinition;
1115
+ selected: boolean;
1116
+ /** @deprecated Use `schemaType` instead */
1117
+ type: BlockDecoratorDefinition;
1118
+ value: string;
1119
+ }
1120
+ /** @beta */
1121
+ interface BlockListItemRenderProps {
1122
+ block: PortableTextTextBlock;
1123
+ children: ReactElement<any>;
1124
+ editorElementRef: RefObject<HTMLElement | null>;
1125
+ focused: boolean;
1126
+ level: number;
1127
+ path: Path;
1128
+ schemaType: BlockListDefinition;
1129
+ selected: boolean;
1130
+ value: string;
1131
+ }
1132
+ /** @beta */
1133
+ type RenderBlockFunction = (props: BlockRenderProps) => JSX.Element;
1134
+ /** @beta */
1135
+ type RenderChildFunction = (props: BlockChildRenderProps) => JSX.Element;
1136
+ /** @beta */
1137
+ type RenderEditableFunction = (props: PortableTextEditableProps) => JSX.Element;
1138
+ /** @beta */
1139
+ type RenderAnnotationFunction = (props: BlockAnnotationRenderProps) => JSX.Element;
1140
+ /** @beta */
1141
+ type RenderPlaceholderFunction = () => React.ReactNode;
1142
+ /** @beta */
1143
+ type RenderStyleFunction = (props: BlockStyleRenderProps) => JSX.Element;
1144
+ /** @beta */
1145
+ interface BlockStyleRenderProps {
1146
+ block: PortableTextTextBlock;
1147
+ children: ReactElement<any>;
1148
+ editorElementRef: RefObject<HTMLElement | null>;
1149
+ focused: boolean;
1150
+ path: Path;
1151
+ selected: boolean;
1152
+ schemaType: BlockStyleDefinition;
1153
+ value: string;
1154
+ }
1155
+ /** @beta */
1156
+ type RenderListItemFunction = (props: BlockListItemRenderProps) => JSX.Element;
1157
+ /** @beta */
1158
+ type RenderDecoratorFunction = (props: BlockDecoratorRenderProps) => JSX.Element;
1159
+ /** @beta */
1160
+ type ScrollSelectionIntoViewFunction = (editor: PortableTextEditor, domRange: globalThis.Range) => void;
1161
+ /**
1162
+ * Parameters for the callback that will be called for a RangeDecoration's onMoved.
1163
+ * @alpha */
1164
+ interface RangeDecorationOnMovedDetails {
1165
+ rangeDecoration: RangeDecoration;
1166
+ newSelection: EditorSelection;
1167
+ origin: 'remote' | 'local';
1168
+ }
1169
+ /**
1170
+ * A range decoration is a UI affordance that wraps a given selection range in the editor
1171
+ * with a custom component. This can be used to highlight search results,
1172
+ * mark validation errors on specific words, draw user presence and similar.
1173
+ * @alpha */
1174
+ interface RangeDecoration {
1175
+ /**
1176
+ * A component for rendering the range decoration.
1177
+ * The component will receive the children (text) of the range decoration as its children.
1178
+ *
1179
+ * @example
1180
+ * ```ts
1181
+ * (rangeComponentProps: PropsWithChildren) => (
1182
+ * <SearchResultHighlight>
1183
+ * {rangeComponentProps.children}
1184
+ * </SearchResultHighlight>
1185
+ * )
1186
+ * ```
1187
+ */
1188
+ component: (props: PropsWithChildren) => ReactElement<any>;
1189
+ /**
1190
+ * The editor content selection range
1191
+ */
1192
+ selection: EditorSelection;
1193
+ /**
1194
+ * A optional callback that will be called when the range decoration potentially moves according to user edits.
1195
+ */
1196
+ onMoved?: (details: RangeDecorationOnMovedDetails) => void;
1197
+ /**
1198
+ * A custom payload that can be set on the range decoration
1199
+ */
1200
+ payload?: Record<string, unknown>;
1201
+ }
1202
+ /** @beta */
1203
+ type PortableTextMemberSchemaTypes = {
1204
+ annotations: (ObjectSchemaType & {
1205
+ i18nTitleKey?: string;
1206
+ })[];
1207
+ block: ObjectSchemaType;
1208
+ blockObjects: ObjectSchemaType[];
1209
+ decorators: BlockDecoratorDefinition[];
1210
+ inlineObjects: ObjectSchemaType[];
1211
+ portableText: ArraySchemaType<PortableTextBlock>;
1212
+ span: ObjectSchemaType;
1213
+ styles: BlockStyleDefinition[];
1214
+ lists: BlockListDefinition[];
1215
+ };
1216
+ /**
1217
+ * @public
1218
+ */
1219
+ type EditorContext = {
1220
+ converters: Array<Converter>;
1221
+ keyGenerator: () => string;
1222
+ readOnly: boolean;
1223
+ schema: EditorSchema;
1224
+ selection: EditorSelection;
1225
+ value: Array<PortableTextBlock>;
1226
+ };
1227
+ /**
1228
+ * @public
1229
+ */
1230
+ type EditorSnapshot = {
1231
+ context: EditorContext;
1232
+ blockIndexMap: Map<string, number>;
1233
+ /**
1234
+ * @beta
1235
+ * Subject to change
1236
+ */
1237
+ decoratorState: Record<string, boolean | undefined>;
1238
+ };
1239
+ type Converter<TMIMEType extends MIMEType = MIMEType> = {
1240
+ mimeType: TMIMEType;
1241
+ serialize: Serializer<TMIMEType>;
1242
+ deserialize: Deserializer<TMIMEType>;
1243
+ };
1244
+ type ConverterEvent<TMIMEType extends MIMEType = MIMEType> = {
1245
+ type: 'serialize';
1246
+ originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart';
1247
+ } | {
1248
+ type: 'serialization.failure';
1249
+ mimeType: TMIMEType;
1250
+ originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart';
1251
+ reason: string;
1252
+ } | {
1253
+ type: 'serialization.success';
1254
+ data: string;
1255
+ mimeType: TMIMEType;
1256
+ originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart';
1257
+ } | {
1258
+ type: 'deserialize';
1259
+ data: string;
1260
+ } | {
1261
+ type: 'deserialization.failure';
1262
+ mimeType: TMIMEType;
1263
+ reason: string;
1264
+ } | {
1265
+ type: 'deserialization.success';
1266
+ data: Array<PortableTextBlock>;
1267
+ mimeType: TMIMEType;
1268
+ };
1269
+ type Serializer<TMIMEType extends MIMEType> = ({
1270
+ snapshot,
1271
+ event
1272
+ }: {
1273
+ snapshot: EditorSnapshot;
1274
+ event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialize'>;
1275
+ }) => PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialization.success' | 'serialization.failure'>;
1276
+ type Deserializer<TMIMEType extends MIMEType> = ({
1277
+ snapshot,
1278
+ event
1279
+ }: {
1280
+ snapshot: EditorSnapshot;
1281
+ event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialize'>;
1282
+ }) => PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialization.success' | 'deserialization.failure'>;
1283
+ /**
1284
+ * @public
1285
+ */
1286
+ type PatchesEvent = {
1287
+ type: 'patches';
1288
+ patches: Array<Patch>;
1289
+ snapshot: Array<PortableTextBlock> | undefined;
1290
+ };
1291
+ /**
1292
+ * @public
1293
+ */
1294
+ type ExternalEditorEvent = {
1295
+ type: 'update readOnly';
1296
+ readOnly: boolean;
1297
+ } | {
1298
+ type: 'update maxBlocks';
1299
+ maxBlocks: number | undefined;
1300
+ } | PatchesEvent;
1301
+ type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
1302
+ operationId?: string;
1303
+ value: Array<PortableTextBlock>;
1304
+ };
1305
+ /**
1306
+ * @internal
1307
+ */
1308
+ type EditorActor = ActorRefFrom<typeof editorMachine>;
1309
+ /**
1310
+ * @internal
1311
+ */
1312
+
1313
+ /**
1314
+ * @internal
1315
+ */
1316
+ declare const editorMachine: xstate227.StateMachine<{
1317
+ behaviors: Set<BehaviorConfig>;
1318
+ behaviorsSorted: boolean;
1319
+ converters: Set<Converter>;
1320
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1321
+ keyGenerator: () => string;
1322
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
1323
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
1324
+ schema: EditorSchema;
1325
+ initialReadOnly: boolean;
1326
+ maxBlocks: number | undefined;
1327
+ selection: EditorSelection;
1328
+ initialValue: Array<PortableTextBlock> | undefined;
1329
+ internalDrag?: {
1330
+ origin: Pick<EventPosition, "selection">;
1331
+ };
1332
+ dragGhost?: HTMLElement;
1333
+ slateEditor?: PortableTextSlateEditor;
1334
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1335
+ type: "update readOnly";
1336
+ readOnly: boolean;
1337
+ } | {
1338
+ type: "update maxBlocks";
1339
+ maxBlocks: number | undefined;
1340
+ } | {
1341
+ type: "add behavior";
1342
+ behaviorConfig: BehaviorConfig;
1343
+ } | {
1344
+ type: "remove behavior";
1345
+ behaviorConfig: BehaviorConfig;
1346
+ } | {
1347
+ type: "blur";
1348
+ editor: PortableTextSlateEditor;
1349
+ } | {
1350
+ type: "focus";
1351
+ editor: PortableTextSlateEditor;
1352
+ } | {
1353
+ type: "normalizing";
1354
+ } | {
1355
+ type: "update selection";
1356
+ selection: EditorSelection;
1357
+ } | {
1358
+ type: "done normalizing";
1359
+ } | {
1360
+ type: "done syncing value";
1361
+ } | {
1362
+ type: "syncing value";
1363
+ } | {
1364
+ type: "behavior event";
1365
+ behaviorEvent: BehaviorEvent;
1366
+ editor: PortableTextSlateEditor;
1367
+ nativeEvent?: {
1368
+ preventDefault: () => void;
1369
+ };
1370
+ } | {
1371
+ type: "set drag ghost";
1372
+ ghost: HTMLElement;
1373
+ } | {
1374
+ type: "dragstart";
1375
+ ghost?: HTMLElement;
1376
+ origin: Pick<EventPosition, "selection">;
1377
+ } | {
1378
+ type: "dragend";
1379
+ } | {
1380
+ type: "drop";
1381
+ }, {}, never, xstate227.Values<{
1382
+ "add behavior to context": {
1383
+ type: "add behavior to context";
1384
+ params: xstate227.NonReducibleUnknown;
1385
+ };
1386
+ "remove behavior from context": {
1387
+ type: "remove behavior from context";
1388
+ params: xstate227.NonReducibleUnknown;
1389
+ };
1390
+ "emit patch event": {
1391
+ type: "emit patch event";
1392
+ params: xstate227.NonReducibleUnknown;
1393
+ };
1394
+ "emit mutation event": {
1395
+ type: "emit mutation event";
1396
+ params: xstate227.NonReducibleUnknown;
1397
+ };
1398
+ "emit read only": {
1399
+ type: "emit read only";
1400
+ params: xstate227.NonReducibleUnknown;
1401
+ };
1402
+ "emit editable": {
1403
+ type: "emit editable";
1404
+ params: xstate227.NonReducibleUnknown;
1405
+ };
1406
+ "defer event": {
1407
+ type: "defer event";
1408
+ params: xstate227.NonReducibleUnknown;
1409
+ };
1410
+ "emit pending events": {
1411
+ type: "emit pending events";
1412
+ params: xstate227.NonReducibleUnknown;
1413
+ };
1414
+ "emit ready": {
1415
+ type: "emit ready";
1416
+ params: xstate227.NonReducibleUnknown;
1417
+ };
1418
+ "clear pending events": {
1419
+ type: "clear pending events";
1420
+ params: xstate227.NonReducibleUnknown;
1421
+ };
1422
+ "defer incoming patches": {
1423
+ type: "defer incoming patches";
1424
+ params: xstate227.NonReducibleUnknown;
1425
+ };
1426
+ "emit pending incoming patches": {
1427
+ type: "emit pending incoming patches";
1428
+ params: xstate227.NonReducibleUnknown;
1429
+ };
1430
+ "clear pending incoming patches": {
1431
+ type: "clear pending incoming patches";
1432
+ params: xstate227.NonReducibleUnknown;
1433
+ };
1434
+ "handle blur": {
1435
+ type: "handle blur";
1436
+ params: unknown;
1437
+ };
1438
+ "handle focus": {
1439
+ type: "handle focus";
1440
+ params: unknown;
1441
+ };
1442
+ "handle behavior event": {
1443
+ type: "handle behavior event";
1444
+ params: unknown;
1445
+ };
1446
+ "sort behaviors": {
1447
+ type: "sort behaviors";
1448
+ params: xstate227.NonReducibleUnknown;
1449
+ };
1450
+ }>, {
1451
+ type: "slate is busy";
1452
+ params: unknown;
1453
+ }, never, {
1454
+ "edit mode": {
1455
+ editable: "dragging internally" | "idle" | {
1456
+ focusing: "checking if busy" | "busy";
1457
+ };
1458
+ } | {
1459
+ "read only": "read only" | "determine initial edit mode";
1460
+ };
1461
+ setup: "setting up" | {
1462
+ "set up": {
1463
+ "value sync": "syncing value" | "idle";
1464
+ writing: "dirty" | {
1465
+ pristine: "normalizing" | "idle";
1466
+ };
1467
+ };
1468
+ };
1469
+ }, "dragging internally", {
1470
+ converters?: Array<Converter>;
1471
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1472
+ keyGenerator: () => string;
1473
+ maxBlocks?: number;
1474
+ readOnly?: boolean;
1475
+ schema: EditorSchema;
1476
+ initialValue?: Array<PortableTextBlock>;
1477
+ }, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
1478
+ type: "blurred";
1479
+ event: react22.FocusEvent<HTMLDivElement, Element>;
1480
+ } | {
1481
+ type: "done loading";
1482
+ } | {
1483
+ type: "editable";
1484
+ } | {
1485
+ type: "error";
1486
+ name: string;
1487
+ description: string;
1488
+ data: unknown;
1489
+ } | {
1490
+ type: "focused";
1491
+ event: react22.FocusEvent<HTMLDivElement, Element>;
1492
+ } | {
1493
+ type: "invalid value";
1494
+ resolution: InvalidValueResolution | null;
1495
+ value: Array<PortableTextBlock> | undefined;
1496
+ } | {
1497
+ type: "loading";
1498
+ } | {
1499
+ type: "read only";
1500
+ } | {
1501
+ type: "ready";
1502
+ } | {
1503
+ type: "selection";
1504
+ selection: EditorSelection;
1505
+ } | {
1506
+ type: "value changed";
1507
+ value: Array<PortableTextBlock> | undefined;
1508
+ }, xstate227.MetaObject, {
1509
+ readonly id: "editor";
1510
+ readonly context: ({
1511
+ input
1512
+ }: {
1513
+ spawn: {
1514
+ <TSrc extends never>(logic: TSrc, ...[options]: never): xstate227.ActorRefFromLogic<never>;
1515
+ <TLogic extends xstate227.AnyActorLogic>(src: TLogic, ...[options]: xstate227.ConditionalRequired<[options?: ({
1516
+ id?: never;
1517
+ systemId?: string;
1518
+ input?: xstate227.InputFrom<TLogic> | undefined;
1519
+ syncSnapshot?: boolean;
1520
+ } & { [K in xstate227.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate227.IsNotNever<xstate227.RequiredLogicInput<TLogic>>>): xstate227.ActorRefFromLogic<TLogic>;
1521
+ };
1522
+ input: {
1523
+ converters?: Array<Converter>;
1524
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1525
+ keyGenerator: () => string;
1526
+ maxBlocks?: number;
1527
+ readOnly?: boolean;
1528
+ schema: EditorSchema;
1529
+ initialValue?: Array<PortableTextBlock>;
1530
+ };
1531
+ self: xstate227.ActorRef<xstate227.MachineSnapshot<{
1532
+ behaviors: Set<BehaviorConfig>;
1533
+ behaviorsSorted: boolean;
1534
+ converters: Set<Converter>;
1535
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1536
+ keyGenerator: () => string;
1537
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
1538
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
1539
+ schema: EditorSchema;
1540
+ initialReadOnly: boolean;
1541
+ maxBlocks: number | undefined;
1542
+ selection: EditorSelection;
1543
+ initialValue: Array<PortableTextBlock> | undefined;
1544
+ internalDrag?: {
1545
+ origin: Pick<EventPosition, "selection">;
1546
+ };
1547
+ dragGhost?: HTMLElement;
1548
+ slateEditor?: PortableTextSlateEditor;
1549
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1550
+ type: "update readOnly";
1551
+ readOnly: boolean;
1552
+ } | {
1553
+ type: "update maxBlocks";
1554
+ maxBlocks: number | undefined;
1555
+ } | {
1556
+ type: "add behavior";
1557
+ behaviorConfig: BehaviorConfig;
1558
+ } | {
1559
+ type: "remove behavior";
1560
+ behaviorConfig: BehaviorConfig;
1561
+ } | {
1562
+ type: "blur";
1563
+ editor: PortableTextSlateEditor;
1564
+ } | {
1565
+ type: "focus";
1566
+ editor: PortableTextSlateEditor;
1567
+ } | {
1568
+ type: "normalizing";
1569
+ } | {
1570
+ type: "update selection";
1571
+ selection: EditorSelection;
1572
+ } | {
1573
+ type: "done normalizing";
1574
+ } | {
1575
+ type: "done syncing value";
1576
+ } | {
1577
+ type: "syncing value";
1578
+ } | {
1579
+ type: "behavior event";
1580
+ behaviorEvent: BehaviorEvent;
1581
+ editor: PortableTextSlateEditor;
1582
+ nativeEvent?: {
1583
+ preventDefault: () => void;
1584
+ };
1585
+ } | {
1586
+ type: "set drag ghost";
1587
+ ghost: HTMLElement;
1588
+ } | {
1589
+ type: "dragstart";
1590
+ ghost?: HTMLElement;
1591
+ origin: Pick<EventPosition, "selection">;
1592
+ } | {
1593
+ type: "dragend";
1594
+ } | {
1595
+ type: "drop";
1596
+ }, Record<string, xstate227.AnyActorRef | undefined>, xstate227.StateValue, string, unknown, any, any>, InternalPatchEvent | MutationEvent | PatchesEvent | {
1597
+ type: "update readOnly";
1598
+ readOnly: boolean;
1599
+ } | {
1600
+ type: "update maxBlocks";
1601
+ maxBlocks: number | undefined;
1602
+ } | {
1603
+ type: "add behavior";
1604
+ behaviorConfig: BehaviorConfig;
1605
+ } | {
1606
+ type: "remove behavior";
1607
+ behaviorConfig: BehaviorConfig;
1608
+ } | {
1609
+ type: "blur";
1610
+ editor: PortableTextSlateEditor;
1611
+ } | {
1612
+ type: "focus";
1613
+ editor: PortableTextSlateEditor;
1614
+ } | {
1615
+ type: "normalizing";
1616
+ } | {
1617
+ type: "update selection";
1618
+ selection: EditorSelection;
1619
+ } | {
1620
+ type: "done normalizing";
1621
+ } | {
1622
+ type: "done syncing value";
1623
+ } | {
1624
+ type: "syncing value";
1625
+ } | {
1626
+ type: "behavior event";
1627
+ behaviorEvent: BehaviorEvent;
1628
+ editor: PortableTextSlateEditor;
1629
+ nativeEvent?: {
1630
+ preventDefault: () => void;
1631
+ };
1632
+ } | {
1633
+ type: "set drag ghost";
1634
+ ghost: HTMLElement;
1635
+ } | {
1636
+ type: "dragstart";
1637
+ ghost?: HTMLElement;
1638
+ origin: Pick<EventPosition, "selection">;
1639
+ } | {
1640
+ type: "dragend";
1641
+ } | {
1642
+ type: "drop";
1643
+ }, xstate227.AnyEventObject>;
1644
+ }) => {
1645
+ behaviors: Set<{
1646
+ 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" | "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" | "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, {
1647
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.add">;
1648
+ annotation: {
1649
+ name: string;
1650
+ value: {
1651
+ [prop: string]: unknown;
1652
+ };
1653
+ };
1654
+ } | {
1655
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.remove">;
1656
+ annotation: {
1657
+ name: string;
1658
+ };
1659
+ } | {
1660
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "block.set">;
1661
+ at: BlockPath;
1662
+ props: Record<string, unknown>;
1663
+ } | {
1664
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "block.unset">;
1665
+ at: BlockPath;
1666
+ props: Array<string>;
1667
+ } | {
1668
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "child.set">;
1669
+ at: ChildPath;
1670
+ props: {
1671
+ [prop: string]: unknown;
1672
+ };
1673
+ } | {
1674
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "child.unset">;
1675
+ at: ChildPath;
1676
+ props: Array<string>;
1677
+ } | {
1678
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "decorator.add">;
1679
+ decorator: string;
1680
+ at?: {
1681
+ anchor: BlockOffset;
1682
+ focus: BlockOffset;
1683
+ };
1684
+ } | {
1685
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "decorator.remove">;
1686
+ decorator: string;
1687
+ } | {
1688
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete">;
1689
+ at: NonNullable<EditorSelection>;
1690
+ direction?: "backward" | "forward";
1691
+ unit?: "character" | "word" | "line" | "block";
1692
+ } | {
1693
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "history.redo">;
1694
+ } | {
1695
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "history.undo">;
1696
+ } | {
1697
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.inline object">;
1698
+ inlineObject: {
1699
+ name: string;
1700
+ value?: {
1701
+ [prop: string]: unknown;
1702
+ };
1703
+ };
1704
+ } | {
1705
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.block">;
1706
+ block: BlockWithOptionalKey;
1707
+ placement: InsertPlacement;
1708
+ select?: "start" | "end" | "none";
1709
+ } | {
1710
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.span">;
1711
+ text: string;
1712
+ annotations?: Array<{
1713
+ name: string;
1714
+ value: {
1715
+ [prop: string]: unknown;
1716
+ };
1717
+ }>;
1718
+ decorators?: Array<string>;
1719
+ } | {
1720
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.text">;
1721
+ text: string;
1722
+ } | {
1723
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "move.backward">;
1724
+ distance: number;
1725
+ } | {
1726
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "move.block">;
1727
+ at: BlockPath;
1728
+ to: BlockPath;
1729
+ } | {
1730
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "move.forward">;
1731
+ distance: number;
1732
+ } | {
1733
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "select">;
1734
+ at: EditorSelection;
1735
+ } | {
1736
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.set">;
1737
+ at: AnnotationPath;
1738
+ props: Record<string, unknown>;
1739
+ } | {
1740
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.toggle">;
1741
+ annotation: {
1742
+ name: string;
1743
+ value: {
1744
+ [prop: string]: unknown;
1745
+ };
1746
+ };
1747
+ } | {
1748
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "decorator.toggle">;
1749
+ decorator: string;
1750
+ at?: {
1751
+ anchor: BlockOffset;
1752
+ focus: BlockOffset;
1753
+ };
1754
+ } | {
1755
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete.backward">;
1756
+ unit: "character" | "word" | "line" | "block";
1757
+ } | {
1758
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete.block">;
1759
+ at: BlockPath;
1760
+ } | {
1761
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete.child">;
1762
+ at: ChildPath;
1763
+ } | {
1764
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete.forward">;
1765
+ unit: "character" | "word" | "line" | "block";
1766
+ } | {
1767
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "delete.text">;
1768
+ at: {
1769
+ anchor: BlockOffset;
1770
+ focus: BlockOffset;
1771
+ };
1772
+ } | {
1773
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "deserialize">;
1774
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "drag.drop" | "clipboard.paste"> | InputBehaviorEvent;
1775
+ } | {
1776
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "serialize">;
1777
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "clipboard.copy" | "clipboard.cut" | "drag.dragstart">;
1778
+ } | {
1779
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "deserialization.success">;
1780
+ mimeType: MIMEType;
1781
+ data: Array<PortableTextBlock>;
1782
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "drag.drop" | "clipboard.paste"> | InputBehaviorEvent;
1783
+ } | {
1784
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "deserialization.failure">;
1785
+ mimeType: MIMEType;
1786
+ reason: string;
1787
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "drag.drop" | "clipboard.paste"> | InputBehaviorEvent;
1788
+ } | {
1789
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "serialization.success">;
1790
+ mimeType: MIMEType;
1791
+ data: string;
1792
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "clipboard.copy" | "clipboard.cut" | "drag.dragstart">;
1793
+ } | {
1794
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "serialization.failure">;
1795
+ mimeType: MIMEType;
1796
+ reason: string;
1797
+ originEvent: PickFromUnion<NativeBehaviorEvent, "type", "clipboard.copy" | "clipboard.cut" | "drag.dragstart">;
1798
+ } | {
1799
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.blocks">;
1800
+ blocks: Array<BlockWithOptionalKey>;
1801
+ placement: InsertPlacement;
1802
+ select?: "start" | "end" | "none";
1803
+ } | {
1804
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.break">;
1805
+ } | {
1806
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "insert.soft break">;
1807
+ } | {
1808
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "list item.add">;
1809
+ listItem: string;
1810
+ } | {
1811
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "list item.remove">;
1812
+ listItem: string;
1813
+ } | {
1814
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "list item.toggle">;
1815
+ listItem: string;
1816
+ } | {
1817
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "move.block down">;
1818
+ at: BlockPath;
1819
+ } | {
1820
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "move.block up">;
1821
+ at: BlockPath;
1822
+ } | {
1823
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "select.previous block">;
1824
+ select?: "start" | "end";
1825
+ } | {
1826
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "select.next block">;
1827
+ select?: "start" | "end";
1828
+ } | {
1829
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "split">;
1830
+ } | {
1831
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "style.add">;
1832
+ style: string;
1833
+ } | {
1834
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "style.remove">;
1835
+ style: string;
1836
+ } | {
1837
+ 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" | "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" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "style.toggle">;
1838
+ style: string;
1839
+ } | {
1840
+ type: StrictExtract<"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", "clipboard.copy">;
1841
+ originEvent: {
1842
+ dataTransfer: DataTransfer;
1843
+ };
1844
+ position: Pick<EventPosition, "selection">;
1845
+ } | {
1846
+ type: StrictExtract<"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", "clipboard.cut">;
1847
+ originEvent: {
1848
+ dataTransfer: DataTransfer;
1849
+ };
1850
+ position: Pick<EventPosition, "selection">;
1851
+ } | {
1852
+ type: StrictExtract<"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", "clipboard.paste">;
1853
+ originEvent: {
1854
+ dataTransfer: DataTransfer;
1855
+ };
1856
+ position: Pick<EventPosition, "selection">;
1857
+ } | {
1858
+ type: StrictExtract<"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", "drag.dragstart">;
1859
+ originEvent: {
1860
+ clientX: number;
1861
+ clientY: number;
1862
+ dataTransfer: DataTransfer;
1863
+ };
1864
+ position: Pick<EventPosition, "selection">;
1865
+ } | {
1866
+ type: StrictExtract<"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", "drag.drag">;
1867
+ originEvent: {
1868
+ dataTransfer: DataTransfer;
1869
+ };
1870
+ } | {
1871
+ type: StrictExtract<"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", "drag.dragend">;
1872
+ originEvent: {
1873
+ dataTransfer: DataTransfer;
1874
+ };
1875
+ } | {
1876
+ type: StrictExtract<"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", "drag.dragenter">;
1877
+ originEvent: {
1878
+ dataTransfer: DataTransfer;
1879
+ };
1880
+ position: EventPosition;
1881
+ } | {
1882
+ type: StrictExtract<"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", "drag.dragover">;
1883
+ originEvent: {
1884
+ dataTransfer: DataTransfer;
1885
+ };
1886
+ dragOrigin?: Pick<EventPosition, "selection">;
1887
+ position: EventPosition;
1888
+ } | {
1889
+ type: StrictExtract<"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", "drag.drop">;
1890
+ originEvent: {
1891
+ dataTransfer: DataTransfer;
1892
+ };
1893
+ dragOrigin?: Pick<EventPosition, "selection">;
1894
+ position: EventPosition;
1895
+ } | {
1896
+ type: StrictExtract<"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", "drag.dragleave">;
1897
+ originEvent: {
1898
+ dataTransfer: DataTransfer;
1899
+ };
1900
+ } | InputBehaviorEvent | {
1901
+ type: StrictExtract<"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", "keyboard.keydown">;
1902
+ originEvent: Pick<KeyboardEvent, "key" | "code" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey">;
1903
+ } | {
1904
+ type: StrictExtract<"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", "keyboard.keyup">;
1905
+ originEvent: Pick<KeyboardEvent, "key" | "code" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey">;
1906
+ } | MouseBehaviorEvent | CustomBehaviorEvent<Record<string, unknown>, string, `custom.${string}`>>;
1907
+ priority: EditorPriority;
1908
+ }>;
1909
+ behaviorsSorted: false;
1910
+ converters: Set<Converter>;
1911
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1912
+ keyGenerator: () => string;
1913
+ pendingEvents: never[];
1914
+ pendingIncomingPatchesEvents: never[];
1915
+ schema: EditorSchema;
1916
+ selection: null;
1917
+ initialReadOnly: boolean;
1918
+ maxBlocks: number | undefined;
1919
+ initialValue: PortableTextBlock[] | undefined;
1920
+ };
1921
+ readonly on: {
1922
+ readonly 'add behavior': {
1923
+ readonly actions: "add behavior to context";
1924
+ };
1925
+ readonly 'remove behavior': {
1926
+ readonly actions: "remove behavior from context";
1927
+ };
1928
+ readonly 'update maxBlocks': {
1929
+ readonly actions: xstate227.ActionFunction<{
1930
+ behaviors: Set<BehaviorConfig>;
1931
+ behaviorsSorted: boolean;
1932
+ converters: Set<Converter>;
1933
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
1934
+ keyGenerator: () => string;
1935
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
1936
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
1937
+ schema: EditorSchema;
1938
+ initialReadOnly: boolean;
1939
+ maxBlocks: number | undefined;
1940
+ selection: EditorSelection;
1941
+ initialValue: Array<PortableTextBlock> | undefined;
1942
+ internalDrag?: {
1943
+ origin: Pick<EventPosition, "selection">;
1944
+ };
1945
+ dragGhost?: HTMLElement;
1946
+ slateEditor?: PortableTextSlateEditor;
1947
+ }, {
1948
+ type: "update maxBlocks";
1949
+ maxBlocks: number | undefined;
1950
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1951
+ type: "update readOnly";
1952
+ readOnly: boolean;
1953
+ } | {
1954
+ type: "update maxBlocks";
1955
+ maxBlocks: number | undefined;
1956
+ } | {
1957
+ type: "add behavior";
1958
+ behaviorConfig: BehaviorConfig;
1959
+ } | {
1960
+ type: "remove behavior";
1961
+ behaviorConfig: BehaviorConfig;
1962
+ } | {
1963
+ type: "blur";
1964
+ editor: PortableTextSlateEditor;
1965
+ } | {
1966
+ type: "focus";
1967
+ editor: PortableTextSlateEditor;
1968
+ } | {
1969
+ type: "normalizing";
1970
+ } | {
1971
+ type: "update selection";
1972
+ selection: EditorSelection;
1973
+ } | {
1974
+ type: "done normalizing";
1975
+ } | {
1976
+ type: "done syncing value";
1977
+ } | {
1978
+ type: "syncing value";
1979
+ } | {
1980
+ type: "behavior event";
1981
+ behaviorEvent: BehaviorEvent;
1982
+ editor: PortableTextSlateEditor;
1983
+ nativeEvent?: {
1984
+ preventDefault: () => void;
1985
+ };
1986
+ } | {
1987
+ type: "set drag ghost";
1988
+ ghost: HTMLElement;
1989
+ } | {
1990
+ type: "dragstart";
1991
+ ghost?: HTMLElement;
1992
+ origin: Pick<EventPosition, "selection">;
1993
+ } | {
1994
+ type: "dragend";
1995
+ } | {
1996
+ type: "drop";
1997
+ }, undefined, never, never, never, never, never>;
1998
+ };
1999
+ readonly 'update selection': {
2000
+ readonly actions: readonly [xstate227.ActionFunction<{
2001
+ behaviors: Set<BehaviorConfig>;
2002
+ behaviorsSorted: boolean;
2003
+ converters: Set<Converter>;
2004
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2005
+ keyGenerator: () => string;
2006
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2007
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2008
+ schema: EditorSchema;
2009
+ initialReadOnly: boolean;
2010
+ maxBlocks: number | undefined;
2011
+ selection: EditorSelection;
2012
+ initialValue: Array<PortableTextBlock> | undefined;
2013
+ internalDrag?: {
2014
+ origin: Pick<EventPosition, "selection">;
2015
+ };
2016
+ dragGhost?: HTMLElement;
2017
+ slateEditor?: PortableTextSlateEditor;
2018
+ }, {
2019
+ type: "update selection";
2020
+ selection: EditorSelection;
2021
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2022
+ type: "update readOnly";
2023
+ readOnly: boolean;
2024
+ } | {
2025
+ type: "update maxBlocks";
2026
+ maxBlocks: number | undefined;
2027
+ } | {
2028
+ type: "add behavior";
2029
+ behaviorConfig: BehaviorConfig;
2030
+ } | {
2031
+ type: "remove behavior";
2032
+ behaviorConfig: BehaviorConfig;
2033
+ } | {
2034
+ type: "blur";
2035
+ editor: PortableTextSlateEditor;
2036
+ } | {
2037
+ type: "focus";
2038
+ editor: PortableTextSlateEditor;
2039
+ } | {
2040
+ type: "normalizing";
2041
+ } | {
2042
+ type: "update selection";
2043
+ selection: EditorSelection;
2044
+ } | {
2045
+ type: "done normalizing";
2046
+ } | {
2047
+ type: "done syncing value";
2048
+ } | {
2049
+ type: "syncing value";
2050
+ } | {
2051
+ type: "behavior event";
2052
+ behaviorEvent: BehaviorEvent;
2053
+ editor: PortableTextSlateEditor;
2054
+ nativeEvent?: {
2055
+ preventDefault: () => void;
2056
+ };
2057
+ } | {
2058
+ type: "set drag ghost";
2059
+ ghost: HTMLElement;
2060
+ } | {
2061
+ type: "dragstart";
2062
+ ghost?: HTMLElement;
2063
+ origin: Pick<EventPosition, "selection">;
2064
+ } | {
2065
+ type: "dragend";
2066
+ } | {
2067
+ type: "drop";
2068
+ }, undefined, never, never, never, never, never>, xstate227.ActionFunction<{
2069
+ behaviors: Set<BehaviorConfig>;
2070
+ behaviorsSorted: boolean;
2071
+ converters: Set<Converter>;
2072
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2073
+ keyGenerator: () => string;
2074
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2075
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2076
+ schema: EditorSchema;
2077
+ initialReadOnly: boolean;
2078
+ maxBlocks: number | undefined;
2079
+ selection: EditorSelection;
2080
+ initialValue: Array<PortableTextBlock> | undefined;
2081
+ internalDrag?: {
2082
+ origin: Pick<EventPosition, "selection">;
2083
+ };
2084
+ dragGhost?: HTMLElement;
2085
+ slateEditor?: PortableTextSlateEditor;
2086
+ }, {
2087
+ type: "update selection";
2088
+ selection: EditorSelection;
2089
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2090
+ type: "update readOnly";
2091
+ readOnly: boolean;
2092
+ } | {
2093
+ type: "update maxBlocks";
2094
+ maxBlocks: number | undefined;
2095
+ } | {
2096
+ type: "add behavior";
2097
+ behaviorConfig: BehaviorConfig;
2098
+ } | {
2099
+ type: "remove behavior";
2100
+ behaviorConfig: BehaviorConfig;
2101
+ } | {
2102
+ type: "blur";
2103
+ editor: PortableTextSlateEditor;
2104
+ } | {
2105
+ type: "focus";
2106
+ editor: PortableTextSlateEditor;
2107
+ } | {
2108
+ type: "normalizing";
2109
+ } | {
2110
+ type: "update selection";
2111
+ selection: EditorSelection;
2112
+ } | {
2113
+ type: "done normalizing";
2114
+ } | {
2115
+ type: "done syncing value";
2116
+ } | {
2117
+ type: "syncing value";
2118
+ } | {
2119
+ type: "behavior event";
2120
+ behaviorEvent: BehaviorEvent;
2121
+ editor: PortableTextSlateEditor;
2122
+ nativeEvent?: {
2123
+ preventDefault: () => void;
2124
+ };
2125
+ } | {
2126
+ type: "set drag ghost";
2127
+ ghost: HTMLElement;
2128
+ } | {
2129
+ type: "dragstart";
2130
+ ghost?: HTMLElement;
2131
+ origin: Pick<EventPosition, "selection">;
2132
+ } | {
2133
+ type: "dragend";
2134
+ } | {
2135
+ type: "drop";
2136
+ }, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
2137
+ type: "blurred";
2138
+ event: react22.FocusEvent<HTMLDivElement, Element>;
2139
+ } | {
2140
+ type: "done loading";
2141
+ } | {
2142
+ type: "editable";
2143
+ } | {
2144
+ type: "error";
2145
+ name: string;
2146
+ description: string;
2147
+ data: unknown;
2148
+ } | {
2149
+ type: "focused";
2150
+ event: react22.FocusEvent<HTMLDivElement, Element>;
2151
+ } | {
2152
+ type: "invalid value";
2153
+ resolution: InvalidValueResolution | null;
2154
+ value: Array<PortableTextBlock> | undefined;
2155
+ } | {
2156
+ type: "loading";
2157
+ } | {
2158
+ type: "read only";
2159
+ } | {
2160
+ type: "ready";
2161
+ } | {
2162
+ type: "selection";
2163
+ selection: EditorSelection;
2164
+ } | {
2165
+ type: "value changed";
2166
+ value: Array<PortableTextBlock> | undefined;
2167
+ }>];
2168
+ };
2169
+ readonly 'set drag ghost': {
2170
+ readonly actions: xstate227.ActionFunction<{
2171
+ behaviors: Set<BehaviorConfig>;
2172
+ behaviorsSorted: boolean;
2173
+ converters: Set<Converter>;
2174
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2175
+ keyGenerator: () => string;
2176
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2177
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2178
+ schema: EditorSchema;
2179
+ initialReadOnly: boolean;
2180
+ maxBlocks: number | undefined;
2181
+ selection: EditorSelection;
2182
+ initialValue: Array<PortableTextBlock> | undefined;
2183
+ internalDrag?: {
2184
+ origin: Pick<EventPosition, "selection">;
2185
+ };
2186
+ dragGhost?: HTMLElement;
2187
+ slateEditor?: PortableTextSlateEditor;
2188
+ }, {
2189
+ type: "set drag ghost";
2190
+ ghost: HTMLElement;
2191
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2192
+ type: "update readOnly";
2193
+ readOnly: boolean;
2194
+ } | {
2195
+ type: "update maxBlocks";
2196
+ maxBlocks: number | undefined;
2197
+ } | {
2198
+ type: "add behavior";
2199
+ behaviorConfig: BehaviorConfig;
2200
+ } | {
2201
+ type: "remove behavior";
2202
+ behaviorConfig: BehaviorConfig;
2203
+ } | {
2204
+ type: "blur";
2205
+ editor: PortableTextSlateEditor;
2206
+ } | {
2207
+ type: "focus";
2208
+ editor: PortableTextSlateEditor;
2209
+ } | {
2210
+ type: "normalizing";
2211
+ } | {
2212
+ type: "update selection";
2213
+ selection: EditorSelection;
2214
+ } | {
2215
+ type: "done normalizing";
2216
+ } | {
2217
+ type: "done syncing value";
2218
+ } | {
2219
+ type: "syncing value";
2220
+ } | {
2221
+ type: "behavior event";
2222
+ behaviorEvent: BehaviorEvent;
2223
+ editor: PortableTextSlateEditor;
2224
+ nativeEvent?: {
2225
+ preventDefault: () => void;
2226
+ };
2227
+ } | {
2228
+ type: "set drag ghost";
2229
+ ghost: HTMLElement;
2230
+ } | {
2231
+ type: "dragstart";
2232
+ ghost?: HTMLElement;
2233
+ origin: Pick<EventPosition, "selection">;
2234
+ } | {
2235
+ type: "dragend";
2236
+ } | {
2237
+ type: "drop";
2238
+ }, undefined, never, never, never, never, never>;
2239
+ };
2240
+ };
2241
+ readonly type: "parallel";
2242
+ readonly states: {
2243
+ readonly 'edit mode': {
2244
+ readonly initial: "read only";
2245
+ readonly states: {
2246
+ readonly 'read only': {
2247
+ readonly initial: "determine initial edit mode";
2248
+ readonly on: {
2249
+ readonly 'behavior event': {
2250
+ readonly actions: readonly ["sort behaviors", "handle behavior event"];
2251
+ readonly guard: ({
2252
+ event
2253
+ }: xstate_guards12.GuardArgs<{
2254
+ behaviors: Set<BehaviorConfig>;
2255
+ behaviorsSorted: boolean;
2256
+ converters: Set<Converter>;
2257
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2258
+ keyGenerator: () => string;
2259
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2260
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2261
+ schema: EditorSchema;
2262
+ initialReadOnly: boolean;
2263
+ maxBlocks: number | undefined;
2264
+ selection: EditorSelection;
2265
+ initialValue: Array<PortableTextBlock> | undefined;
2266
+ internalDrag?: {
2267
+ origin: Pick<EventPosition, "selection">;
2268
+ };
2269
+ dragGhost?: HTMLElement;
2270
+ slateEditor?: PortableTextSlateEditor;
2271
+ }, {
2272
+ type: "behavior event";
2273
+ behaviorEvent: BehaviorEvent;
2274
+ editor: PortableTextSlateEditor;
2275
+ nativeEvent?: {
2276
+ preventDefault: () => void;
2277
+ };
2278
+ }>) => boolean;
2279
+ };
2280
+ };
2281
+ readonly states: {
2282
+ readonly 'determine initial edit mode': {
2283
+ readonly entry: readonly [() => void];
2284
+ readonly exit: readonly [() => void];
2285
+ readonly on: {
2286
+ readonly 'done syncing value': readonly [{
2287
+ readonly target: "#editor.edit mode.read only.read only";
2288
+ readonly guard: ({
2289
+ context
2290
+ }: xstate_guards12.GuardArgs<{
2291
+ behaviors: Set<BehaviorConfig>;
2292
+ behaviorsSorted: boolean;
2293
+ converters: Set<Converter>;
2294
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2295
+ keyGenerator: () => string;
2296
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2297
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2298
+ schema: EditorSchema;
2299
+ initialReadOnly: boolean;
2300
+ maxBlocks: number | undefined;
2301
+ selection: EditorSelection;
2302
+ initialValue: Array<PortableTextBlock> | undefined;
2303
+ internalDrag?: {
2304
+ origin: Pick<EventPosition, "selection">;
2305
+ };
2306
+ dragGhost?: HTMLElement;
2307
+ slateEditor?: PortableTextSlateEditor;
2308
+ }, {
2309
+ type: "done syncing value";
2310
+ }>) => boolean;
2311
+ }, {
2312
+ readonly target: "#editor.edit mode.editable";
2313
+ }];
2314
+ };
2315
+ };
2316
+ readonly 'read only': {
2317
+ readonly entry: readonly [() => void];
2318
+ readonly exit: readonly [() => void];
2319
+ readonly on: {
2320
+ readonly 'update readOnly': {
2321
+ readonly guard: ({
2322
+ event
2323
+ }: xstate_guards12.GuardArgs<{
2324
+ behaviors: Set<BehaviorConfig>;
2325
+ behaviorsSorted: boolean;
2326
+ converters: Set<Converter>;
2327
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2328
+ keyGenerator: () => string;
2329
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2330
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2331
+ schema: EditorSchema;
2332
+ initialReadOnly: boolean;
2333
+ maxBlocks: number | undefined;
2334
+ selection: EditorSelection;
2335
+ initialValue: Array<PortableTextBlock> | undefined;
2336
+ internalDrag?: {
2337
+ origin: Pick<EventPosition, "selection">;
2338
+ };
2339
+ dragGhost?: HTMLElement;
2340
+ slateEditor?: PortableTextSlateEditor;
2341
+ }, {
2342
+ type: "update readOnly";
2343
+ readOnly: boolean;
2344
+ }>) => boolean;
2345
+ readonly target: "#editor.edit mode.editable";
2346
+ readonly actions: readonly ["emit editable"];
2347
+ };
2348
+ };
2349
+ };
2350
+ };
2351
+ };
2352
+ readonly editable: {
2353
+ readonly on: {
2354
+ readonly 'update readOnly': {
2355
+ readonly guard: ({
2356
+ event
2357
+ }: xstate_guards12.GuardArgs<{
2358
+ behaviors: Set<BehaviorConfig>;
2359
+ behaviorsSorted: boolean;
2360
+ converters: Set<Converter>;
2361
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2362
+ keyGenerator: () => string;
2363
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2364
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2365
+ schema: EditorSchema;
2366
+ initialReadOnly: boolean;
2367
+ maxBlocks: number | undefined;
2368
+ selection: EditorSelection;
2369
+ initialValue: Array<PortableTextBlock> | undefined;
2370
+ internalDrag?: {
2371
+ origin: Pick<EventPosition, "selection">;
2372
+ };
2373
+ dragGhost?: HTMLElement;
2374
+ slateEditor?: PortableTextSlateEditor;
2375
+ }, {
2376
+ type: "update readOnly";
2377
+ readOnly: boolean;
2378
+ }>) => boolean;
2379
+ readonly target: "#editor.edit mode.read only.read only";
2380
+ readonly actions: readonly ["emit read only"];
2381
+ };
2382
+ readonly 'behavior event': {
2383
+ readonly actions: readonly ["sort behaviors", "handle behavior event"];
2384
+ };
2385
+ readonly blur: {
2386
+ readonly actions: "handle blur";
2387
+ };
2388
+ readonly focus: {
2389
+ readonly target: ".focusing";
2390
+ readonly actions: readonly [xstate227.ActionFunction<{
2391
+ behaviors: Set<BehaviorConfig>;
2392
+ behaviorsSorted: boolean;
2393
+ converters: Set<Converter>;
2394
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2395
+ keyGenerator: () => string;
2396
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2397
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2398
+ schema: EditorSchema;
2399
+ initialReadOnly: boolean;
2400
+ maxBlocks: number | undefined;
2401
+ selection: EditorSelection;
2402
+ initialValue: Array<PortableTextBlock> | undefined;
2403
+ internalDrag?: {
2404
+ origin: Pick<EventPosition, "selection">;
2405
+ };
2406
+ dragGhost?: HTMLElement;
2407
+ slateEditor?: PortableTextSlateEditor;
2408
+ }, {
2409
+ type: "focus";
2410
+ editor: PortableTextSlateEditor;
2411
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2412
+ type: "update readOnly";
2413
+ readOnly: boolean;
2414
+ } | {
2415
+ type: "update maxBlocks";
2416
+ maxBlocks: number | undefined;
2417
+ } | {
2418
+ type: "add behavior";
2419
+ behaviorConfig: BehaviorConfig;
2420
+ } | {
2421
+ type: "remove behavior";
2422
+ behaviorConfig: BehaviorConfig;
2423
+ } | {
2424
+ type: "blur";
2425
+ editor: PortableTextSlateEditor;
2426
+ } | {
2427
+ type: "focus";
2428
+ editor: PortableTextSlateEditor;
2429
+ } | {
2430
+ type: "normalizing";
2431
+ } | {
2432
+ type: "update selection";
2433
+ selection: EditorSelection;
2434
+ } | {
2435
+ type: "done normalizing";
2436
+ } | {
2437
+ type: "done syncing value";
2438
+ } | {
2439
+ type: "syncing value";
2440
+ } | {
2441
+ type: "behavior event";
2442
+ behaviorEvent: BehaviorEvent;
2443
+ editor: PortableTextSlateEditor;
2444
+ nativeEvent?: {
2445
+ preventDefault: () => void;
2446
+ };
2447
+ } | {
2448
+ type: "set drag ghost";
2449
+ ghost: HTMLElement;
2450
+ } | {
2451
+ type: "dragstart";
2452
+ ghost?: HTMLElement;
2453
+ origin: Pick<EventPosition, "selection">;
2454
+ } | {
2455
+ type: "dragend";
2456
+ } | {
2457
+ type: "drop";
2458
+ }, undefined, never, never, never, never, never>];
2459
+ };
2460
+ };
2461
+ readonly initial: "idle";
2462
+ readonly states: {
2463
+ readonly idle: {
2464
+ readonly entry: readonly [() => void];
2465
+ readonly exit: readonly [() => void];
2466
+ readonly on: {
2467
+ readonly dragstart: {
2468
+ readonly actions: readonly [xstate227.ActionFunction<{
2469
+ behaviors: Set<BehaviorConfig>;
2470
+ behaviorsSorted: boolean;
2471
+ converters: Set<Converter>;
2472
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2473
+ keyGenerator: () => string;
2474
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2475
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2476
+ schema: EditorSchema;
2477
+ initialReadOnly: boolean;
2478
+ maxBlocks: number | undefined;
2479
+ selection: EditorSelection;
2480
+ initialValue: Array<PortableTextBlock> | undefined;
2481
+ internalDrag?: {
2482
+ origin: Pick<EventPosition, "selection">;
2483
+ };
2484
+ dragGhost?: HTMLElement;
2485
+ slateEditor?: PortableTextSlateEditor;
2486
+ }, {
2487
+ type: "dragstart";
2488
+ ghost?: HTMLElement;
2489
+ origin: Pick<EventPosition, "selection">;
2490
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2491
+ type: "update readOnly";
2492
+ readOnly: boolean;
2493
+ } | {
2494
+ type: "update maxBlocks";
2495
+ maxBlocks: number | undefined;
2496
+ } | {
2497
+ type: "add behavior";
2498
+ behaviorConfig: BehaviorConfig;
2499
+ } | {
2500
+ type: "remove behavior";
2501
+ behaviorConfig: BehaviorConfig;
2502
+ } | {
2503
+ type: "blur";
2504
+ editor: PortableTextSlateEditor;
2505
+ } | {
2506
+ type: "focus";
2507
+ editor: PortableTextSlateEditor;
2508
+ } | {
2509
+ type: "normalizing";
2510
+ } | {
2511
+ type: "update selection";
2512
+ selection: EditorSelection;
2513
+ } | {
2514
+ type: "done normalizing";
2515
+ } | {
2516
+ type: "done syncing value";
2517
+ } | {
2518
+ type: "syncing value";
2519
+ } | {
2520
+ type: "behavior event";
2521
+ behaviorEvent: BehaviorEvent;
2522
+ editor: PortableTextSlateEditor;
2523
+ nativeEvent?: {
2524
+ preventDefault: () => void;
2525
+ };
2526
+ } | {
2527
+ type: "set drag ghost";
2528
+ ghost: HTMLElement;
2529
+ } | {
2530
+ type: "dragstart";
2531
+ ghost?: HTMLElement;
2532
+ origin: Pick<EventPosition, "selection">;
2533
+ } | {
2534
+ type: "dragend";
2535
+ } | {
2536
+ type: "drop";
2537
+ }, undefined, never, never, never, never, never>];
2538
+ readonly target: "dragging internally";
2539
+ };
2540
+ };
2541
+ };
2542
+ readonly focusing: {
2543
+ readonly initial: "checking if busy";
2544
+ readonly states: {
2545
+ readonly 'checking if busy': {
2546
+ readonly entry: readonly [() => void];
2547
+ readonly exit: readonly [() => void];
2548
+ readonly always: readonly [{
2549
+ readonly guard: "slate is busy";
2550
+ readonly target: "busy";
2551
+ }, {
2552
+ readonly target: "#editor.edit mode.editable.idle";
2553
+ readonly actions: readonly ["handle focus"];
2554
+ }];
2555
+ };
2556
+ readonly busy: {
2557
+ readonly entry: readonly [() => void];
2558
+ readonly exit: readonly [() => void];
2559
+ readonly after: {
2560
+ readonly 10: {
2561
+ readonly target: "checking if busy";
2562
+ };
2563
+ };
2564
+ };
2565
+ };
2566
+ };
2567
+ readonly 'dragging internally': {
2568
+ readonly entry: readonly [() => void];
2569
+ readonly exit: readonly [() => void, ({
2570
+ context
2571
+ }: xstate227.ActionArgs<{
2572
+ behaviors: Set<BehaviorConfig>;
2573
+ behaviorsSorted: boolean;
2574
+ converters: Set<Converter>;
2575
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2576
+ keyGenerator: () => string;
2577
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2578
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2579
+ schema: EditorSchema;
2580
+ initialReadOnly: boolean;
2581
+ maxBlocks: number | undefined;
2582
+ selection: EditorSelection;
2583
+ initialValue: Array<PortableTextBlock> | undefined;
2584
+ internalDrag?: {
2585
+ origin: Pick<EventPosition, "selection">;
2586
+ };
2587
+ dragGhost?: HTMLElement;
2588
+ slateEditor?: PortableTextSlateEditor;
2589
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2590
+ type: "update readOnly";
2591
+ readOnly: boolean;
2592
+ } | {
2593
+ type: "update maxBlocks";
2594
+ maxBlocks: number | undefined;
2595
+ } | {
2596
+ type: "add behavior";
2597
+ behaviorConfig: BehaviorConfig;
2598
+ } | {
2599
+ type: "remove behavior";
2600
+ behaviorConfig: BehaviorConfig;
2601
+ } | {
2602
+ type: "blur";
2603
+ editor: PortableTextSlateEditor;
2604
+ } | {
2605
+ type: "focus";
2606
+ editor: PortableTextSlateEditor;
2607
+ } | {
2608
+ type: "normalizing";
2609
+ } | {
2610
+ type: "update selection";
2611
+ selection: EditorSelection;
2612
+ } | {
2613
+ type: "done normalizing";
2614
+ } | {
2615
+ type: "done syncing value";
2616
+ } | {
2617
+ type: "syncing value";
2618
+ } | {
2619
+ type: "behavior event";
2620
+ behaviorEvent: BehaviorEvent;
2621
+ editor: PortableTextSlateEditor;
2622
+ nativeEvent?: {
2623
+ preventDefault: () => void;
2624
+ };
2625
+ } | {
2626
+ type: "set drag ghost";
2627
+ ghost: HTMLElement;
2628
+ } | {
2629
+ type: "dragstart";
2630
+ ghost?: HTMLElement;
2631
+ origin: Pick<EventPosition, "selection">;
2632
+ } | {
2633
+ type: "dragend";
2634
+ } | {
2635
+ type: "drop";
2636
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2637
+ type: "update readOnly";
2638
+ readOnly: boolean;
2639
+ } | {
2640
+ type: "update maxBlocks";
2641
+ maxBlocks: number | undefined;
2642
+ } | {
2643
+ type: "add behavior";
2644
+ behaviorConfig: BehaviorConfig;
2645
+ } | {
2646
+ type: "remove behavior";
2647
+ behaviorConfig: BehaviorConfig;
2648
+ } | {
2649
+ type: "blur";
2650
+ editor: PortableTextSlateEditor;
2651
+ } | {
2652
+ type: "focus";
2653
+ editor: PortableTextSlateEditor;
2654
+ } | {
2655
+ type: "normalizing";
2656
+ } | {
2657
+ type: "update selection";
2658
+ selection: EditorSelection;
2659
+ } | {
2660
+ type: "done normalizing";
2661
+ } | {
2662
+ type: "done syncing value";
2663
+ } | {
2664
+ type: "syncing value";
2665
+ } | {
2666
+ type: "behavior event";
2667
+ behaviorEvent: BehaviorEvent;
2668
+ editor: PortableTextSlateEditor;
2669
+ nativeEvent?: {
2670
+ preventDefault: () => void;
2671
+ };
2672
+ } | {
2673
+ type: "set drag ghost";
2674
+ ghost: HTMLElement;
2675
+ } | {
2676
+ type: "dragstart";
2677
+ ghost?: HTMLElement;
2678
+ origin: Pick<EventPosition, "selection">;
2679
+ } | {
2680
+ type: "dragend";
2681
+ } | {
2682
+ type: "drop";
2683
+ }>) => void, xstate227.ActionFunction<{
2684
+ behaviors: Set<BehaviorConfig>;
2685
+ behaviorsSorted: boolean;
2686
+ converters: Set<Converter>;
2687
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2688
+ keyGenerator: () => string;
2689
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2690
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2691
+ schema: EditorSchema;
2692
+ initialReadOnly: boolean;
2693
+ maxBlocks: number | undefined;
2694
+ selection: EditorSelection;
2695
+ initialValue: Array<PortableTextBlock> | undefined;
2696
+ internalDrag?: {
2697
+ origin: Pick<EventPosition, "selection">;
2698
+ };
2699
+ dragGhost?: HTMLElement;
2700
+ slateEditor?: PortableTextSlateEditor;
2701
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2702
+ type: "update readOnly";
2703
+ readOnly: boolean;
2704
+ } | {
2705
+ type: "update maxBlocks";
2706
+ maxBlocks: number | undefined;
2707
+ } | {
2708
+ type: "add behavior";
2709
+ behaviorConfig: BehaviorConfig;
2710
+ } | {
2711
+ type: "remove behavior";
2712
+ behaviorConfig: BehaviorConfig;
2713
+ } | {
2714
+ type: "blur";
2715
+ editor: PortableTextSlateEditor;
2716
+ } | {
2717
+ type: "focus";
2718
+ editor: PortableTextSlateEditor;
2719
+ } | {
2720
+ type: "normalizing";
2721
+ } | {
2722
+ type: "update selection";
2723
+ selection: EditorSelection;
2724
+ } | {
2725
+ type: "done normalizing";
2726
+ } | {
2727
+ type: "done syncing value";
2728
+ } | {
2729
+ type: "syncing value";
2730
+ } | {
2731
+ type: "behavior event";
2732
+ behaviorEvent: BehaviorEvent;
2733
+ editor: PortableTextSlateEditor;
2734
+ nativeEvent?: {
2735
+ preventDefault: () => void;
2736
+ };
2737
+ } | {
2738
+ type: "set drag ghost";
2739
+ ghost: HTMLElement;
2740
+ } | {
2741
+ type: "dragstart";
2742
+ ghost?: HTMLElement;
2743
+ origin: Pick<EventPosition, "selection">;
2744
+ } | {
2745
+ type: "dragend";
2746
+ } | {
2747
+ type: "drop";
2748
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2749
+ type: "update readOnly";
2750
+ readOnly: boolean;
2751
+ } | {
2752
+ type: "update maxBlocks";
2753
+ maxBlocks: number | undefined;
2754
+ } | {
2755
+ type: "add behavior";
2756
+ behaviorConfig: BehaviorConfig;
2757
+ } | {
2758
+ type: "remove behavior";
2759
+ behaviorConfig: BehaviorConfig;
2760
+ } | {
2761
+ type: "blur";
2762
+ editor: PortableTextSlateEditor;
2763
+ } | {
2764
+ type: "focus";
2765
+ editor: PortableTextSlateEditor;
2766
+ } | {
2767
+ type: "normalizing";
2768
+ } | {
2769
+ type: "update selection";
2770
+ selection: EditorSelection;
2771
+ } | {
2772
+ type: "done normalizing";
2773
+ } | {
2774
+ type: "done syncing value";
2775
+ } | {
2776
+ type: "syncing value";
2777
+ } | {
2778
+ type: "behavior event";
2779
+ behaviorEvent: BehaviorEvent;
2780
+ editor: PortableTextSlateEditor;
2781
+ nativeEvent?: {
2782
+ preventDefault: () => void;
2783
+ };
2784
+ } | {
2785
+ type: "set drag ghost";
2786
+ ghost: HTMLElement;
2787
+ } | {
2788
+ type: "dragstart";
2789
+ ghost?: HTMLElement;
2790
+ origin: Pick<EventPosition, "selection">;
2791
+ } | {
2792
+ type: "dragend";
2793
+ } | {
2794
+ type: "drop";
2795
+ }, undefined, never, never, never, never, never>, xstate227.ActionFunction<{
2796
+ behaviors: Set<BehaviorConfig>;
2797
+ behaviorsSorted: boolean;
2798
+ converters: Set<Converter>;
2799
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2800
+ keyGenerator: () => string;
2801
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2802
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2803
+ schema: EditorSchema;
2804
+ initialReadOnly: boolean;
2805
+ maxBlocks: number | undefined;
2806
+ selection: EditorSelection;
2807
+ initialValue: Array<PortableTextBlock> | undefined;
2808
+ internalDrag?: {
2809
+ origin: Pick<EventPosition, "selection">;
2810
+ };
2811
+ dragGhost?: HTMLElement;
2812
+ slateEditor?: PortableTextSlateEditor;
2813
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2814
+ type: "update readOnly";
2815
+ readOnly: boolean;
2816
+ } | {
2817
+ type: "update maxBlocks";
2818
+ maxBlocks: number | undefined;
2819
+ } | {
2820
+ type: "add behavior";
2821
+ behaviorConfig: BehaviorConfig;
2822
+ } | {
2823
+ type: "remove behavior";
2824
+ behaviorConfig: BehaviorConfig;
2825
+ } | {
2826
+ type: "blur";
2827
+ editor: PortableTextSlateEditor;
2828
+ } | {
2829
+ type: "focus";
2830
+ editor: PortableTextSlateEditor;
2831
+ } | {
2832
+ type: "normalizing";
2833
+ } | {
2834
+ type: "update selection";
2835
+ selection: EditorSelection;
2836
+ } | {
2837
+ type: "done normalizing";
2838
+ } | {
2839
+ type: "done syncing value";
2840
+ } | {
2841
+ type: "syncing value";
2842
+ } | {
2843
+ type: "behavior event";
2844
+ behaviorEvent: BehaviorEvent;
2845
+ editor: PortableTextSlateEditor;
2846
+ nativeEvent?: {
2847
+ preventDefault: () => void;
2848
+ };
2849
+ } | {
2850
+ type: "set drag ghost";
2851
+ ghost: HTMLElement;
2852
+ } | {
2853
+ type: "dragstart";
2854
+ ghost?: HTMLElement;
2855
+ origin: Pick<EventPosition, "selection">;
2856
+ } | {
2857
+ type: "dragend";
2858
+ } | {
2859
+ type: "drop";
2860
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2861
+ type: "update readOnly";
2862
+ readOnly: boolean;
2863
+ } | {
2864
+ type: "update maxBlocks";
2865
+ maxBlocks: number | undefined;
2866
+ } | {
2867
+ type: "add behavior";
2868
+ behaviorConfig: BehaviorConfig;
2869
+ } | {
2870
+ type: "remove behavior";
2871
+ behaviorConfig: BehaviorConfig;
2872
+ } | {
2873
+ type: "blur";
2874
+ editor: PortableTextSlateEditor;
2875
+ } | {
2876
+ type: "focus";
2877
+ editor: PortableTextSlateEditor;
2878
+ } | {
2879
+ type: "normalizing";
2880
+ } | {
2881
+ type: "update selection";
2882
+ selection: EditorSelection;
2883
+ } | {
2884
+ type: "done normalizing";
2885
+ } | {
2886
+ type: "done syncing value";
2887
+ } | {
2888
+ type: "syncing value";
2889
+ } | {
2890
+ type: "behavior event";
2891
+ behaviorEvent: BehaviorEvent;
2892
+ editor: PortableTextSlateEditor;
2893
+ nativeEvent?: {
2894
+ preventDefault: () => void;
2895
+ };
2896
+ } | {
2897
+ type: "set drag ghost";
2898
+ ghost: HTMLElement;
2899
+ } | {
2900
+ type: "dragstart";
2901
+ ghost?: HTMLElement;
2902
+ origin: Pick<EventPosition, "selection">;
2903
+ } | {
2904
+ type: "dragend";
2905
+ } | {
2906
+ type: "drop";
2907
+ }, undefined, never, never, never, never, never>];
2908
+ readonly tags: readonly ["dragging internally"];
2909
+ readonly on: {
2910
+ readonly dragend: {
2911
+ readonly target: "idle";
2912
+ };
2913
+ readonly drop: {
2914
+ readonly target: "idle";
2915
+ };
2916
+ };
2917
+ };
2918
+ };
2919
+ };
2920
+ };
2921
+ };
2922
+ readonly setup: {
2923
+ readonly initial: "setting up";
2924
+ readonly states: {
2925
+ readonly 'setting up': {
2926
+ readonly entry: readonly [() => void];
2927
+ readonly exit: readonly [() => void, "emit ready", "emit pending incoming patches", "clear pending incoming patches"];
2928
+ readonly on: {
2929
+ readonly 'internal.patch': {
2930
+ readonly actions: "defer event";
2931
+ };
2932
+ readonly mutation: {
2933
+ readonly actions: "defer event";
2934
+ };
2935
+ readonly 'done syncing value': {
2936
+ readonly target: "set up";
2937
+ };
2938
+ readonly patches: {
2939
+ readonly actions: readonly ["defer incoming patches"];
2940
+ };
2941
+ };
2942
+ };
2943
+ readonly 'set up': {
2944
+ readonly type: "parallel";
2945
+ readonly states: {
2946
+ readonly 'value sync': {
2947
+ readonly initial: "idle";
2948
+ readonly states: {
2949
+ readonly idle: {
2950
+ readonly entry: readonly [() => void];
2951
+ readonly exit: readonly [() => void];
2952
+ readonly on: {
2953
+ readonly patches: {
2954
+ readonly actions: readonly [xstate227.ActionFunction<{
2955
+ behaviors: Set<BehaviorConfig>;
2956
+ behaviorsSorted: boolean;
2957
+ converters: Set<Converter>;
2958
+ getLegacySchema: () => PortableTextMemberSchemaTypes;
2959
+ keyGenerator: () => string;
2960
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>;
2961
+ pendingIncomingPatchesEvents: Array<PatchesEvent>;
2962
+ schema: EditorSchema;
2963
+ initialReadOnly: boolean;
2964
+ maxBlocks: number | undefined;
2965
+ selection: EditorSelection;
2966
+ initialValue: Array<PortableTextBlock> | undefined;
2967
+ internalDrag?: {
2968
+ origin: Pick<EventPosition, "selection">;
2969
+ };
2970
+ dragGhost?: HTMLElement;
2971
+ slateEditor?: PortableTextSlateEditor;
2972
+ }, PatchesEvent, InternalPatchEvent | MutationEvent | PatchesEvent | {
2973
+ type: "update readOnly";
2974
+ readOnly: boolean;
2975
+ } | {
2976
+ type: "update maxBlocks";
2977
+ maxBlocks: number | undefined;
2978
+ } | {
2979
+ type: "add behavior";
2980
+ behaviorConfig: BehaviorConfig;
2981
+ } | {
2982
+ type: "remove behavior";
2983
+ behaviorConfig: BehaviorConfig;
2984
+ } | {
2985
+ type: "blur";
2986
+ editor: PortableTextSlateEditor;
2987
+ } | {
2988
+ type: "focus";
2989
+ editor: PortableTextSlateEditor;
2990
+ } | {
2991
+ type: "normalizing";
2992
+ } | {
2993
+ type: "update selection";
2994
+ selection: EditorSelection;
2995
+ } | {
2996
+ type: "done normalizing";
2997
+ } | {
2998
+ type: "done syncing value";
2999
+ } | {
3000
+ type: "syncing value";
3001
+ } | {
3002
+ type: "behavior event";
3003
+ behaviorEvent: BehaviorEvent;
3004
+ editor: PortableTextSlateEditor;
3005
+ nativeEvent?: {
3006
+ preventDefault: () => void;
3007
+ };
3008
+ } | {
3009
+ type: "set drag ghost";
3010
+ ghost: HTMLElement;
3011
+ } | {
3012
+ type: "dragstart";
3013
+ ghost?: HTMLElement;
3014
+ origin: Pick<EventPosition, "selection">;
3015
+ } | {
3016
+ type: "dragend";
3017
+ } | {
3018
+ type: "drop";
3019
+ }, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
3020
+ type: "blurred";
3021
+ event: react22.FocusEvent<HTMLDivElement, Element>;
3022
+ } | {
3023
+ type: "done loading";
3024
+ } | {
3025
+ type: "editable";
3026
+ } | {
3027
+ type: "error";
3028
+ name: string;
3029
+ description: string;
3030
+ data: unknown;
3031
+ } | {
3032
+ type: "focused";
3033
+ event: react22.FocusEvent<HTMLDivElement, Element>;
3034
+ } | {
3035
+ type: "invalid value";
3036
+ resolution: InvalidValueResolution | null;
3037
+ value: Array<PortableTextBlock> | undefined;
3038
+ } | {
3039
+ type: "loading";
3040
+ } | {
3041
+ type: "read only";
3042
+ } | {
3043
+ type: "ready";
3044
+ } | {
3045
+ type: "selection";
3046
+ selection: EditorSelection;
3047
+ } | {
3048
+ type: "value changed";
3049
+ value: Array<PortableTextBlock> | undefined;
3050
+ }>];
3051
+ };
3052
+ readonly 'syncing value': {
3053
+ readonly target: "syncing value";
3054
+ };
3055
+ };
3056
+ };
3057
+ readonly 'syncing value': {
3058
+ readonly entry: readonly [() => void];
3059
+ readonly exit: readonly [() => void, "emit pending incoming patches", "clear pending incoming patches"];
3060
+ readonly on: {
3061
+ readonly patches: {
3062
+ readonly actions: readonly ["defer incoming patches"];
3063
+ };
3064
+ readonly 'done syncing value': {
3065
+ readonly target: "idle";
3066
+ };
3067
+ };
3068
+ };
3069
+ };
3070
+ };
3071
+ readonly writing: {
3072
+ readonly initial: "pristine";
3073
+ readonly states: {
3074
+ readonly pristine: {
3075
+ readonly initial: "idle";
3076
+ readonly states: {
3077
+ readonly idle: {
3078
+ readonly entry: readonly [() => void];
3079
+ readonly exit: readonly [() => void];
3080
+ readonly on: {
3081
+ readonly normalizing: {
3082
+ readonly target: "normalizing";
3083
+ };
3084
+ readonly 'internal.patch': {
3085
+ readonly actions: "defer event";
3086
+ readonly target: "#editor.setup.set up.writing.dirty";
3087
+ };
3088
+ readonly mutation: {
3089
+ readonly actions: "defer event";
3090
+ readonly target: "#editor.setup.set up.writing.dirty";
3091
+ };
3092
+ };
3093
+ };
3094
+ readonly normalizing: {
3095
+ readonly entry: readonly [() => void];
3096
+ readonly exit: readonly [() => void];
3097
+ readonly on: {
3098
+ readonly 'done normalizing': {
3099
+ readonly target: "idle";
3100
+ };
3101
+ readonly 'internal.patch': {
3102
+ readonly actions: "defer event";
3103
+ };
3104
+ readonly mutation: {
3105
+ readonly actions: "defer event";
3106
+ };
3107
+ };
3108
+ };
3109
+ };
3110
+ };
3111
+ readonly dirty: {
3112
+ readonly entry: readonly [() => void, "emit pending events", "clear pending events"];
3113
+ readonly exit: readonly [() => void];
3114
+ readonly on: {
3115
+ readonly 'internal.patch': {
3116
+ readonly actions: "emit patch event";
3117
+ };
3118
+ readonly mutation: {
3119
+ readonly actions: "emit mutation event";
3120
+ };
3121
+ };
3122
+ };
3123
+ };
3124
+ };
3125
+ };
3126
+ };
3127
+ };
3128
+ };
3129
+ };
3130
+ }>;
3131
+ type EventPosition = {
3132
+ block: 'start' | 'end';
3133
+ /**
3134
+ * Did the event origin from the editor DOM node itself or from a child node?
3135
+ */
3136
+ isEditor: boolean;
3137
+ selection: NonNullable<EditorSelection>;
3138
+ };
3139
+ /**
3140
+ * @beta
3141
+ */
3142
+ type BlockOffset = {
3143
+ path: BlockPath;
3144
+ offset: number;
3145
+ };
3146
+ /**
3147
+ * @beta
3148
+ */
3149
+ type BehaviorEvent = SyntheticBehaviorEvent | NativeBehaviorEvent | CustomBehaviorEvent;
3150
+ type BehaviorEventTypeNamespace = SyntheticBehaviorEventNamespace | NativeBehaviorEventNamespace | CustomBehaviorEventNamespace;
3151
+ type NamespacedBehaviorEventType<TNamespace extends BehaviorEventTypeNamespace | ''> = TNamespace extends '' ? BehaviorEvent['type'] : Extract<BehaviorEvent['type'], TNamespace | `${TNamespace}.${string}`>;
3152
+ /**************************************
3153
+ * External events
3154
+ **************************************/
3155
+ type ExternalBehaviorEventNamespace = 'blur' | 'focus' | 'insert';
3156
+ type ExternalBehaviorEventType<TNamespace extends ExternalBehaviorEventNamespace, TType extends string = ''> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`;
3157
+ type ExternalBehaviorEvent = {
3158
+ type: ExternalBehaviorEventType<'blur'>;
3159
+ } | {
3160
+ type: ExternalBehaviorEventType<'focus'>;
3161
+ } | {
3162
+ type: ExternalBehaviorEventType<'insert', 'block object'>;
3163
+ placement: InsertPlacement;
3164
+ blockObject: {
3165
+ name: string;
3166
+ value?: {
3167
+ [prop: string]: unknown;
3168
+ };
3169
+ };
3170
+ } | SyntheticBehaviorEvent | CustomBehaviorEvent;
3171
+ /**************************************
3172
+ * Synthetic events
3173
+ **************************************/
3174
+ declare const syntheticBehaviorEventTypes: readonly ["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"];
3175
+ type SyntheticBehaviorEventType = (typeof syntheticBehaviorEventTypes)[number] | (typeof abstractBehaviorEventTypes)[number];
3176
+ type SyntheticBehaviorEventNamespace = ExtractNamespace<SyntheticBehaviorEventType>;
3177
+ /**
3178
+ * @beta
3179
+ */
3180
+ type SyntheticBehaviorEvent = {
3181
+ type: StrictExtract<SyntheticBehaviorEventType, 'annotation.add'>;
3182
+ annotation: {
3183
+ name: string;
3184
+ value: {
3185
+ [prop: string]: unknown;
3186
+ };
3187
+ };
3188
+ } | {
3189
+ type: StrictExtract<SyntheticBehaviorEventType, 'annotation.remove'>;
3190
+ annotation: {
3191
+ name: string;
3192
+ };
3193
+ } | {
3194
+ type: StrictExtract<SyntheticBehaviorEventType, 'block.set'>;
3195
+ at: BlockPath;
3196
+ props: Record<string, unknown>;
3197
+ } | {
3198
+ type: StrictExtract<SyntheticBehaviorEventType, 'block.unset'>;
3199
+ at: BlockPath;
3200
+ props: Array<string>;
3201
+ } | {
3202
+ type: StrictExtract<SyntheticBehaviorEventType, 'child.set'>;
3203
+ at: ChildPath;
3204
+ props: {
3205
+ [prop: string]: unknown;
3206
+ };
3207
+ } | {
3208
+ type: StrictExtract<SyntheticBehaviorEventType, 'child.unset'>;
3209
+ at: ChildPath;
3210
+ props: Array<string>;
3211
+ } | {
3212
+ type: StrictExtract<SyntheticBehaviorEventType, 'decorator.add'>;
3213
+ decorator: string;
3214
+ at?: {
3215
+ anchor: BlockOffset;
3216
+ focus: BlockOffset;
3217
+ };
3218
+ } | {
3219
+ type: StrictExtract<SyntheticBehaviorEventType, 'decorator.remove'>;
3220
+ decorator: string;
3221
+ } | {
3222
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete'>;
3223
+ at: NonNullable<EditorSelection>;
3224
+ /**
3225
+ * Defaults to forward deletion.
3226
+ */
3227
+ direction?: 'backward' | 'forward';
3228
+ /**
3229
+ * Defaults to character deletion.
3230
+ */
3231
+ unit?: 'character' | 'word' | 'line' | 'block';
3232
+ } | {
3233
+ type: StrictExtract<SyntheticBehaviorEventType, 'history.redo'>;
3234
+ } | {
3235
+ type: StrictExtract<SyntheticBehaviorEventType, 'history.undo'>;
3236
+ } | {
3237
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.inline object'>;
3238
+ inlineObject: {
3239
+ name: string;
3240
+ value?: {
3241
+ [prop: string]: unknown;
3242
+ };
3243
+ };
3244
+ } | {
3245
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.block'>;
3246
+ block: BlockWithOptionalKey;
3247
+ placement: InsertPlacement;
3248
+ select?: 'start' | 'end' | 'none';
3249
+ } | {
3250
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.span'>;
3251
+ text: string;
3252
+ annotations?: Array<{
3253
+ name: string;
3254
+ value: {
3255
+ [prop: string]: unknown;
3256
+ };
3257
+ }>;
3258
+ decorators?: Array<string>;
3259
+ } | {
3260
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.text'>;
3261
+ text: string;
3262
+ } | {
3263
+ type: StrictExtract<SyntheticBehaviorEventType, 'move.backward'>;
3264
+ distance: number;
3265
+ } | {
3266
+ type: StrictExtract<SyntheticBehaviorEventType, 'move.block'>;
3267
+ at: BlockPath;
3268
+ to: BlockPath;
3269
+ } | {
3270
+ type: StrictExtract<SyntheticBehaviorEventType, 'move.forward'>;
3271
+ distance: number;
3272
+ } | {
3273
+ type: StrictExtract<SyntheticBehaviorEventType, 'select'>;
3274
+ at: EditorSelection;
3275
+ } | AbstractBehaviorEvent;
3276
+ /**
3277
+ * @beta
3278
+ */
3279
+ type InsertPlacement = 'auto' | 'after' | 'before';
3280
+ /**************************************
3281
+ * Abstract events
3282
+ **************************************/
3283
+ declare const abstractBehaviorEventTypes: readonly ["annotation.set", "annotation.toggle", "decorator.toggle", "delete.backward", "delete.block", "delete.child", "delete.forward", "delete.text", "deserialize", "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", "serialization.success", "serialization.failure", "split", "style.add", "style.remove", "style.toggle"];
3284
+ type AbstractBehaviorEvent = {
3285
+ type: StrictExtract<SyntheticBehaviorEventType, 'annotation.set'>;
3286
+ at: AnnotationPath;
3287
+ props: Record<string, unknown>;
3288
+ } | {
3289
+ type: StrictExtract<SyntheticBehaviorEventType, 'annotation.toggle'>;
3290
+ annotation: {
3291
+ name: string;
3292
+ value: {
3293
+ [prop: string]: unknown;
3294
+ };
3295
+ };
3296
+ } | {
3297
+ type: StrictExtract<SyntheticBehaviorEventType, 'decorator.toggle'>;
3298
+ decorator: string;
3299
+ at?: {
3300
+ anchor: BlockOffset;
3301
+ focus: BlockOffset;
3302
+ };
3303
+ } | {
3304
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>;
3305
+ unit: 'character' | 'word' | 'line' | 'block';
3306
+ } | {
3307
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete.block'>;
3308
+ at: BlockPath;
3309
+ } | {
3310
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete.child'>;
3311
+ at: ChildPath;
3312
+ } | {
3313
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>;
3314
+ unit: 'character' | 'word' | 'line' | 'block';
3315
+ } | {
3316
+ type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>;
3317
+ at: {
3318
+ anchor: BlockOffset;
3319
+ focus: BlockOffset;
3320
+ };
3321
+ } | {
3322
+ type: StrictExtract<SyntheticBehaviorEventType, 'deserialize'>;
3323
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'drag.drop' | 'clipboard.paste'> | InputBehaviorEvent;
3324
+ } | {
3325
+ type: StrictExtract<SyntheticBehaviorEventType, 'serialize'>;
3326
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'>;
3327
+ } | {
3328
+ type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.success'>;
3329
+ mimeType: MIMEType;
3330
+ data: Array<PortableTextBlock>;
3331
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'drag.drop' | 'clipboard.paste'> | InputBehaviorEvent;
3332
+ } | {
3333
+ type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.failure'>;
3334
+ mimeType: MIMEType;
3335
+ reason: string;
3336
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'drag.drop' | 'clipboard.paste'> | InputBehaviorEvent;
3337
+ } | {
3338
+ type: StrictExtract<SyntheticBehaviorEventType, 'serialization.success'>;
3339
+ mimeType: MIMEType;
3340
+ data: string;
3341
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'>;
3342
+ } | {
3343
+ type: StrictExtract<SyntheticBehaviorEventType, 'serialization.failure'>;
3344
+ mimeType: MIMEType;
3345
+ reason: string;
3346
+ originEvent: PickFromUnion<NativeBehaviorEvent, 'type', 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'>;
3347
+ } | {
3348
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.blocks'>;
3349
+ blocks: Array<BlockWithOptionalKey>;
3350
+ placement: InsertPlacement;
3351
+ select?: 'start' | 'end' | 'none';
3352
+ } | {
3353
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.break'>;
3354
+ } | {
3355
+ type: StrictExtract<SyntheticBehaviorEventType, 'insert.soft break'>;
3356
+ } | {
3357
+ type: StrictExtract<SyntheticBehaviorEventType, 'list item.add'>;
3358
+ listItem: string;
3359
+ } | {
3360
+ type: StrictExtract<SyntheticBehaviorEventType, 'list item.remove'>;
3361
+ listItem: string;
3362
+ } | {
3363
+ type: StrictExtract<SyntheticBehaviorEventType, 'list item.toggle'>;
3364
+ listItem: string;
3365
+ } | {
3366
+ type: StrictExtract<SyntheticBehaviorEventType, 'move.block down'>;
3367
+ at: BlockPath;
3368
+ } | {
3369
+ type: StrictExtract<SyntheticBehaviorEventType, 'move.block up'>;
3370
+ at: BlockPath;
3371
+ } | {
3372
+ type: StrictExtract<SyntheticBehaviorEventType, 'select.previous block'>;
3373
+ select?: 'start' | 'end';
3374
+ } | {
3375
+ type: StrictExtract<SyntheticBehaviorEventType, 'select.next block'>;
3376
+ select?: 'start' | 'end';
3377
+ } | {
3378
+ type: StrictExtract<SyntheticBehaviorEventType, 'split'>;
3379
+ } | {
3380
+ type: StrictExtract<SyntheticBehaviorEventType, 'style.add'>;
3381
+ style: string;
3382
+ } | {
3383
+ type: StrictExtract<SyntheticBehaviorEventType, 'style.remove'>;
3384
+ style: string;
3385
+ } | {
3386
+ type: StrictExtract<SyntheticBehaviorEventType, 'style.toggle'>;
3387
+ style: string;
3388
+ };
3389
+ /**************************************
3390
+ * Native events
3391
+ **************************************/
3392
+ declare const nativeBehaviorEventTypes: readonly ["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"];
3393
+ type NativeBehaviorEventType = (typeof nativeBehaviorEventTypes)[number];
3394
+ type NativeBehaviorEventNamespace = ExtractNamespace<NativeBehaviorEventType>;
3395
+ /**
3396
+ * @beta
3397
+ */
3398
+ type NativeBehaviorEvent = ClipboardBehaviorEvent | DragBehaviorEvent | InputBehaviorEvent | KeyboardBehaviorEvent | MouseBehaviorEvent;
3399
+ type ClipboardBehaviorEvent = {
3400
+ type: StrictExtract<NativeBehaviorEventType, 'clipboard.copy'>;
3401
+ originEvent: {
3402
+ dataTransfer: DataTransfer;
3403
+ };
3404
+ position: Pick<EventPosition, 'selection'>;
3405
+ } | {
3406
+ type: StrictExtract<NativeBehaviorEventType, 'clipboard.cut'>;
3407
+ originEvent: {
3408
+ dataTransfer: DataTransfer;
3409
+ };
3410
+ position: Pick<EventPosition, 'selection'>;
3411
+ } | {
3412
+ type: StrictExtract<NativeBehaviorEventType, 'clipboard.paste'>;
3413
+ originEvent: {
3414
+ dataTransfer: DataTransfer;
3415
+ };
3416
+ position: Pick<EventPosition, 'selection'>;
3417
+ };
3418
+ type DragBehaviorEvent = {
3419
+ type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>;
3420
+ originEvent: {
3421
+ clientX: number;
3422
+ clientY: number;
3423
+ dataTransfer: DataTransfer;
3424
+ };
3425
+ position: Pick<EventPosition, 'selection'>;
3426
+ } | {
3427
+ type: StrictExtract<NativeBehaviorEventType, 'drag.drag'>;
3428
+ originEvent: {
3429
+ dataTransfer: DataTransfer;
3430
+ };
3431
+ } | {
3432
+ type: StrictExtract<NativeBehaviorEventType, 'drag.dragend'>;
3433
+ originEvent: {
3434
+ dataTransfer: DataTransfer;
3435
+ };
3436
+ } | {
3437
+ type: StrictExtract<NativeBehaviorEventType, 'drag.dragenter'>;
3438
+ originEvent: {
3439
+ dataTransfer: DataTransfer;
3440
+ };
3441
+ position: EventPosition;
3442
+ } | {
3443
+ type: StrictExtract<NativeBehaviorEventType, 'drag.dragover'>;
3444
+ originEvent: {
3445
+ dataTransfer: DataTransfer;
3446
+ };
3447
+ dragOrigin?: Pick<EventPosition, 'selection'>;
3448
+ position: EventPosition;
3449
+ } | {
3450
+ type: StrictExtract<NativeBehaviorEventType, 'drag.drop'>;
3451
+ originEvent: {
3452
+ dataTransfer: DataTransfer;
3453
+ };
3454
+ dragOrigin?: Pick<EventPosition, 'selection'>;
3455
+ position: EventPosition;
3456
+ } | {
3457
+ type: StrictExtract<NativeBehaviorEventType, 'drag.dragleave'>;
3458
+ originEvent: {
3459
+ dataTransfer: DataTransfer;
3460
+ };
3461
+ };
3462
+ /**
3463
+ * Used to represent native InputEvents that hold a DataTransfer object.
3464
+ *
3465
+ * These can either be one of:
3466
+ *
3467
+ * - insertFromPaste
3468
+ * - insertFromPasteAsQuotation
3469
+ * - insertFromDrop
3470
+ * - insertReplacementText
3471
+ * - insertFromYank
3472
+ */
3473
+ type InputBehaviorEvent = {
3474
+ type: StrictExtract<NativeBehaviorEventType, 'input.*'>;
3475
+ originEvent: {
3476
+ dataTransfer: DataTransfer;
3477
+ };
3478
+ };
3479
+ type KeyboardBehaviorEvent = {
3480
+ type: StrictExtract<NativeBehaviorEventType, 'keyboard.keydown'>;
3481
+ originEvent: Pick<KeyboardEvent, 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'>;
3482
+ } | {
3483
+ type: StrictExtract<NativeBehaviorEventType, 'keyboard.keyup'>;
3484
+ originEvent: Pick<KeyboardEvent, 'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'>;
3485
+ };
3486
+ type MouseBehaviorEvent = {
3487
+ type: StrictExtract<NativeBehaviorEventType, 'mouse.click'>;
3488
+ position: EventPosition;
3489
+ };
3490
+ /**************************************
3491
+ * Custom events
3492
+ **************************************/
3493
+ type CustomBehaviorEventNamespace = 'custom';
3494
+ type CustomBehaviorEventType<TNamespace extends CustomBehaviorEventNamespace, TType extends string = ''> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`;
3495
+ /**
3496
+ * @beta
3497
+ */
3498
+ type CustomBehaviorEvent<TPayload extends Record<string, unknown> = Record<string, unknown>, TType extends string = string, TInternalType extends CustomBehaviorEventType<'custom', TType> = CustomBehaviorEventType<'custom', TType>> = {
3499
+ type: TInternalType;
3500
+ } & TPayload;
3501
+ /**************************************
3502
+ * Resolve behavior event
3503
+ **************************************/
3504
+ type ResolveBehaviorEvent<TBehaviorEventType extends '*' | `${BehaviorEventTypeNamespace}.*` | BehaviorEvent['type'], TPayload extends Record<string, unknown> = Record<string, unknown>> = TBehaviorEventType extends '*' ? BehaviorEvent : TBehaviorEventType extends `${infer TNamespace}.*` ? TNamespace extends BehaviorEventTypeNamespace ? PickFromUnion<BehaviorEvent, 'type', NamespacedBehaviorEventType<TNamespace>> : never : TBehaviorEventType extends `custom.${infer TType}` ? CustomBehaviorEvent<TPayload, TType> : TBehaviorEventType extends BehaviorEvent['type'] ? PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType> : never;
3505
+ type ExtractNamespace<TType extends string> = TType extends `${infer Namespace}.${string}` ? Namespace : TType;
3506
+ /**
3507
+ * @beta
3508
+ */
3509
+ type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
3510
+ snapshot: EditorSnapshot;
3511
+ event: TBehaviorEvent;
3512
+ dom: EditorDom;
3513
+ }) => TGuardResponse | false;
3514
+ /**
3515
+ * @beta
3516
+ */
3517
+ type Behavior<TBehaviorEventType extends '*' | `${BehaviorEventTypeNamespace}.*` | BehaviorEvent['type'] = '*' | `${BehaviorEventTypeNamespace}.*` | BehaviorEvent['type'], TGuardResponse = true, TBehaviorEvent extends ResolveBehaviorEvent<TBehaviorEventType> = ResolveBehaviorEvent<TBehaviorEventType>> = {
3518
+ /**
3519
+ * Editor Event that triggers this Behavior.
3520
+ */
3521
+ on: TBehaviorEventType;
3522
+ /**
3523
+ * Predicate function that determines if the Behavior should be executed.
3524
+ * Returning a non-nullable value from the guard will pass the value to the
3525
+ * actions and execute them.
3526
+ */
3527
+ guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>;
3528
+ /**
3529
+ * Array of Behavior Action sets.
3530
+ * Each set represents a step in the history stack.
3531
+ */
3532
+ actions: Array<BehaviorActionSet<TBehaviorEvent, TGuardResponse>>;
3533
+ };
3534
+ /**
3535
+ * @beta
3536
+ *
3537
+ * @example
3538
+ *
3539
+ * ```tsx
3540
+ * const noLowerCaseA = defineBehavior({
3541
+ * on: 'insert.text',
3542
+ * guard: ({event, snapshot}) => event.text === 'a',
3543
+ * actions: [({event, snapshot}) => [{type: 'insert.text', text: 'A'}]],
3544
+ * })
3545
+ * ```
3546
+ *
3547
+ */
3548
+ declare function defineBehavior<TPayload extends Record<string, unknown>, TBehaviorEventType extends '*' | `${BehaviorEventTypeNamespace}.*` | BehaviorEvent['type'] = CustomBehaviorEvent['type'], TGuardResponse = true>(behavior: Behavior<TBehaviorEventType, TGuardResponse, ResolveBehaviorEvent<TBehaviorEventType, TPayload>>): Behavior;
3549
+ /**
3550
+ * @public
3551
+ */
3552
+ type EditorConfig = {
3553
+ /**
3554
+ * @beta
3555
+ */
3556
+ keyGenerator?: () => string;
3557
+ /**
3558
+ * @deprecated Will be removed in the next major version
3559
+ */
3560
+ maxBlocks?: number;
3561
+ readOnly?: boolean;
3562
+ initialValue?: Array<PortableTextBlock>;
3563
+ } & ({
3564
+ schemaDefinition: SchemaDefinition;
3565
+ schema?: undefined;
3566
+ } | {
3567
+ schemaDefinition?: undefined;
3568
+ schema: ArraySchemaType<PortableTextBlock> | ArrayDefinition;
3569
+ });
3570
+ /**
3571
+ * @public
3572
+ */
3573
+ type EditorEvent = ExternalEditorEvent | ExternalBehaviorEvent | {
3574
+ type: 'update value';
3575
+ value: Array<PortableTextBlock> | undefined;
3576
+ };
3577
+ /**
3578
+ * @public
3579
+ */
3580
+ type Editor = {
3581
+ dom: EditorDom;
3582
+ getSnapshot: () => EditorSnapshot;
3583
+ /**
3584
+ * @beta
3585
+ */
3586
+ registerBehavior: (config: {
3587
+ behavior: Behavior;
3588
+ }) => () => void;
3589
+ send: (event: EditorEvent) => void;
3590
+ on: ActorRef<Snapshot<unknown>, EventObject, EditorEmittedEvent>['on'];
3591
+ };
3592
+ /**
3593
+ * @public
3594
+ * @deprecated
3595
+ * This component has been renamed. Use `EventListenerPlugin` instead.
3596
+ *
3597
+ * ```
3598
+ * import {EventListenerPlugin} from '@portabletext/editor/plugins'
3599
+ * ```
3600
+ */
3601
+ declare function EditorEventListener(props: {
3602
+ on: (event: EditorEmittedEvent) => void;
3603
+ }): null;
3604
+ /**
3605
+ * @public
3606
+ */
3607
+ type EditorProviderProps = {
3608
+ initialConfig: EditorConfig;
3609
+ children?: React$1.ReactNode;
3610
+ };
3611
+ /**
3612
+ * @public
3613
+ * The EditorProvider component is used to set up the editor context and configure the Portable Text Editor.
3614
+ * @example
3615
+ * ```tsx
3616
+ * import {EditorProvider} from '@portabletext/editor'
3617
+ *
3618
+ * function App() {
3619
+ * return (
3620
+ * <EditorProvider initialConfig={{ ... }} >
3621
+ * ...
3622
+ * </EditorProvider>
3623
+ * )
3624
+ * }
3625
+ *
3626
+ * ```
3627
+ * @group Components
3628
+ */
3629
+ declare function EditorProvider(props: EditorProviderProps): React$1.JSX.Element;
3630
+ /**
3631
+ * @public
3632
+ */
3633
+ type EditorSelector<TSelected> = (snapshot: EditorSnapshot) => TSelected;
3634
+ /**
3635
+ * @public
3636
+ * Hook to select a value from the editor state.
3637
+ * @example
3638
+ * Pass a selector as the second argument
3639
+ * ```tsx
3640
+ * import { useEditorSelector } from '@portabletext/editor'
3641
+ *
3642
+ * function MyComponent(editor) {
3643
+ * const value = useEditorSelector(editor, selector)
3644
+ * }
3645
+ * ```
3646
+ * @example
3647
+ * Pass an inline selector as the second argument.
3648
+ * In this case, use the editor context to obtain the schema.
3649
+ * ```tsx
3650
+ * import { useEditorSelector } from '@portabletext/editor'
3651
+ *
3652
+ * function MyComponent(editor) {
3653
+ * const schema = useEditorSelector(editor, (snapshot) => snapshot.context.schema)
3654
+ * }
3655
+ * ```
3656
+ * @group Hooks
3657
+ */
3658
+ declare function useEditorSelector<TSelected>(editor: Editor, selector: EditorSelector<TSelected>, compare?: (a: TSelected, b: TSelected) => boolean): TSelected;
3659
+ /**
3660
+ * @deprecated Use `useEditor` to get the current editor instance.
3661
+ * @public
3662
+ * Get the current editor object from the React context.
3663
+ */
3664
+ declare const usePortableTextEditor: () => PortableTextEditor;
3665
+ /**
3666
+ * @deprecated Use `useEditorSelector` to get the current editor selection.
3667
+ * @public
3668
+ * Get the current editor selection from the React context.
3669
+ */
3670
+ declare const usePortableTextEditorSelection: () => EditorSelection;
3671
+ /**
3672
+ * @public
3673
+ */
3674
+ declare const defaultKeyGenerator: () => string;
3675
+ /**
3676
+ * @public
3677
+ * Get the current editor context from the `EditorProvider`.
3678
+ * Must be used inside the `EditorProvider` component.
3679
+ * @returns The current editor object.
3680
+ * @example
3681
+ * ```tsx
3682
+ * import { useEditor } from '@portabletext/editor'
3683
+ *
3684
+ * function MyComponent() {
3685
+ * const editor = useEditor()
3686
+ * }
3687
+ * ```
3688
+ * @group Hooks
3689
+ */
3690
+ declare function useEditor(): Editor;
3691
+ type EditorDom = {
3692
+ getBlockNodes: (snapshot: EditorSnapshot) => Array<Node>;
3693
+ getChildNodes: (snapshot: EditorSnapshot) => Array<Node>;
3694
+ /**
3695
+ * Let the Editor set the drag ghost. This is to be sure that it will get
3696
+ * properly removed again when the drag ends.
3697
+ */
3698
+ setDragGhost: ({
3699
+ event,
3700
+ ghost
3701
+ }: {
3702
+ event: PickFromUnion<BehaviorEvent, 'type', 'drag.dragstart'>;
3703
+ ghost: {
3704
+ element: HTMLElement;
3705
+ x: number;
3706
+ y: number;
3707
+ };
3708
+ }) => void;
3709
+ };
3710
+ /**
3711
+ * @beta
3712
+ */
3713
+ type BehaviorAction = {
3714
+ type: 'execute';
3715
+ event: SyntheticBehaviorEvent;
3716
+ } | {
3717
+ type: 'forward';
3718
+ event: NativeBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent;
3719
+ } | {
3720
+ type: 'raise';
3721
+ event: SyntheticBehaviorEvent | CustomBehaviorEvent;
3722
+ } | {
3723
+ type: 'effect';
3724
+ effect: () => void;
3725
+ };
3726
+ /**
3727
+ * @beta
3728
+ */
3729
+ declare function execute(event: SyntheticBehaviorEvent): PickFromUnion<BehaviorAction, 'type', 'execute'>;
3730
+ /**
3731
+ * @beta
3732
+ */
3733
+ declare function forward(event: NativeBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent): PickFromUnion<BehaviorAction, 'type', 'forward'>;
3734
+ /**
3735
+ * @beta
3736
+ */
3737
+ declare function raise(event: SyntheticBehaviorEvent | CustomBehaviorEvent): PickFromUnion<BehaviorAction, 'type', 'raise'>;
3738
+ /**
3739
+ * @beta
3740
+ */
3741
+ declare function effect(effect: () => void): PickFromUnion<BehaviorAction, 'type', 'effect'>;
3742
+ /**
3743
+ * @beta
3744
+ */
3745
+ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
3746
+ snapshot: EditorSnapshot;
3747
+ event: TBehaviorEvent;
3748
+ dom: EditorDom;
3749
+ }, guardResponse: TGuardResponse) => Array<BehaviorAction>;
3750
+ export { type AddedAnnotationPaths, type AnnotationDefinition, type AnnotationPath, type AnnotationSchemaType, type BaseDefinition, Behavior, BehaviorAction, BehaviorActionSet, BehaviorEvent, BehaviorGuard, type BlockAnnotationRenderProps, type BlockChildRenderProps, type BlockDecoratorRenderProps, type BlockListItemRenderProps, type BlockObjectDefinition, type BlockObjectSchemaType, type BlockOffset, type BlockPath, type BlockRenderProps, type BlockStyleRenderProps, type BlurChange, type ChildPath, type ConnectionChange, CustomBehaviorEvent, type DecoratorDefinition, type DecoratorSchemaType, type EditableAPI, type EditableAPIDeleteOptions, type Editor, type EditorChange, type EditorChanges, type EditorConfig, type EditorContext, type EditorEmittedEvent, type EditorEvent, EditorEventListener, EditorProvider, type EditorProviderProps, type EditorSchema, type EditorSelection, type EditorSelectionPoint, type EditorSelector, type EditorSnapshot, type ErrorChange, type FieldDefinition, type FocusChange, type HotkeyOptions, type InlineObjectDefinition, type InlineObjectSchemaType, InsertPlacement, type InvalidValue, type InvalidValueResolution, type ListDefinition, type ListSchemaType, type LoadingChange, type MutationChange, type MutationEvent, NativeBehaviorEvent, type OnBeforeInputFn, type OnCopyFn, type OnPasteFn, type OnPasteResult, type OnPasteResultOrPromise, type PasteData, type Patch$1 as Patch, type PatchChange, type PatchObservable, type PatchesEvent, type PortableTextBlock$1 as PortableTextBlock, type PortableTextChild$1 as PortableTextChild, PortableTextEditable, type PortableTextEditableProps, PortableTextEditor, type PortableTextEditorProps, type PortableTextMemberSchemaTypes, type PortableTextObject$1 as PortableTextObject, type PortableTextSpan$1 as PortableTextSpan, type PortableTextTextBlock$1 as PortableTextTextBlock, type RangeDecoration, type RangeDecorationOnMovedDetails, type ReadyChange, type RedoChange, type RenderAnnotationFunction, type RenderBlockFunction, type RenderChildFunction, type RenderDecoratorFunction, type RenderEditableFunction, type RenderListItemFunction, type RenderPlaceholderFunction, type RenderStyleFunction, type SchemaDefinition, type ScrollSelectionIntoViewFunction, type SelectionChange, type StyleDefinition, type StyleSchemaType, SyntheticBehaviorEvent, type UndoChange, type UnsetChange, type ValueChange, defaultKeyGenerator, defineBehavior, defineSchema, effect, execute, forward, raise, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };