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