@portabletext/editor 3.3.14 → 3.3.16

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