@portabletext/editor 1.50.8 → 1.52.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-cjs/{util.slice-blocks.cjs → selection-point.cjs} +26 -18
- package/lib/_chunks-cjs/selection-point.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.get-text-before.cjs +13 -10
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +46 -46
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs +21 -17
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +1 -1
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +10 -10
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs +5 -5
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs.map +1 -1
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +3 -3
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +7 -14
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-es/{util.slice-blocks.js → selection-point.js} +26 -18
- package/lib/_chunks-es/selection-point.js.map +1 -0
- package/lib/_chunks-es/selector.get-text-before.js +13 -10
- package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +21 -21
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js +14 -10
- package/lib/_chunks-es/selector.is-selection-expanded.js.map +1 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +2 -2
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
- package/lib/_chunks-es/util.is-equal-selection-points.js +1 -1
- package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js +4 -11
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +25 -2010
- package/lib/behaviors/index.d.ts +25 -2010
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +515 -393
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +361 -34
- package/lib/index.d.ts +361 -34
- package/lib/index.js +471 -349
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +11 -11
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +32 -1986
- package/lib/plugins/index.d.ts +32 -1986
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +11 -7
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +2 -2648
- package/lib/selectors/index.d.ts +2 -2648
- package/lib/selectors/index.js +7 -3
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +25 -14
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +0 -2647
- package/lib/utils/index.d.ts +0 -2647
- package/lib/utils/index.js +14 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +14 -14
- package/src/behaviors/behavior.abstract.delete.ts +0 -2
- package/src/behaviors/behavior.abstract.insert.ts +8 -8
- package/src/behaviors/behavior.abstract.ts +0 -113
- package/src/behaviors/behavior.core.block-element.ts +9 -3
- package/src/behaviors/behavior.core.dnd.ts +328 -1
- package/src/behaviors/behavior.perform-event.ts +10 -0
- package/src/behaviors/behavior.types.action.ts +2 -0
- package/src/behaviors/behavior.types.event.ts +5 -0
- package/src/behaviors/behavior.types.guard.ts +2 -0
- package/src/converters/converter.portable-text.ts +2 -7
- package/src/converters/converter.text-html.ts +1 -3
- package/src/converters/converter.text-plain.ts +3 -5
- package/src/editor/Editable.tsx +6 -133
- package/src/editor/editor-machine.ts +15 -10
- package/src/editor/editor-selector.ts +0 -2
- package/src/editor/editor-snapshot.ts +0 -18
- package/src/internal-utils/create-test-snapshot.ts +0 -2
- package/src/internal-utils/event-position.ts +42 -30
- package/src/internal-utils/selection-block-keys.ts +7 -7
- package/src/internal-utils/selection-elements.ts +108 -0
- package/src/internal-utils/selection-focus-text.ts +13 -9
- package/src/internal-utils/selection-text.ts +9 -78
- package/src/internal-utils/terse-pt.test.ts +108 -26
- package/src/internal-utils/terse-pt.ts +132 -14
- package/src/operations/behavior.operation.decorator.add.ts +0 -2
- package/src/operations/behavior.operation.delete.ts +18 -13
- package/src/operations/behavior.operation.insert.block.ts +5 -1
- package/src/selection/selection-point.ts +22 -0
- package/src/selectors/selector.get-anchor-block.ts +6 -6
- package/src/selectors/selector.get-anchor-child.ts +6 -6
- package/src/selectors/selector.get-selected-spans.ts +16 -19
- package/src/selectors/selector.get-selected-text-blocks.ts +11 -19
- package/src/selectors/selector.get-selection-end-block.ts +30 -0
- package/src/selectors/selector.get-selection-start-block.ts +30 -0
- package/src/selectors/selector.get-text-before.ts +15 -16
- package/src/selectors/selector.get-trimmed-selection.ts +15 -21
- package/src/selectors/selector.is-point-after-selection.ts +11 -19
- package/src/selectors/selector.is-point-before-selection.ts +11 -19
- package/src/selectors/selectors.ts +23 -39
- package/src/utils/util.block-offset.ts +6 -7
- package/src/utils/util.child-selection-point-to-block-offset.ts +6 -7
- package/src/utils/util.selection-point-to-block-offset.ts +5 -6
- package/src/utils/util.slice-blocks.ts +11 -20
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +0 -1
- package/lib/_chunks-es/util.slice-blocks.js.map +0 -1
- package/src/internal-utils/inline-object-selection.ts +0 -115
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,231 +1,11 @@
|
|
|
1
|
-
import type {Patch} from '@portabletext/patches'
|
|
2
1
|
import type {
|
|
3
|
-
ArraySchemaType,
|
|
4
|
-
BlockDecoratorDefinition,
|
|
5
|
-
BlockListDefinition,
|
|
6
|
-
BlockStyleDefinition,
|
|
7
2
|
KeyedSegment,
|
|
8
|
-
ObjectSchemaType,
|
|
9
3
|
Path,
|
|
10
4
|
PortableTextBlock,
|
|
11
5
|
PortableTextChild,
|
|
12
|
-
PortableTextListBlock,
|
|
13
6
|
PortableTextTextBlock,
|
|
14
7
|
} from '@sanity/types'
|
|
15
8
|
import {PortableTextObject, PortableTextSpan} from '@sanity/types'
|
|
16
|
-
import {FocusEvent as FocusEvent_2} from 'react'
|
|
17
|
-
import type {KeyboardEvent as KeyboardEvent_2} from 'react'
|
|
18
|
-
import type {Descendant, Operation} from 'slate'
|
|
19
|
-
import type {DOMNode} from 'slate-dom'
|
|
20
|
-
import type {ReactEditor} from 'slate-react'
|
|
21
|
-
import {
|
|
22
|
-
ActionArgs,
|
|
23
|
-
ActionFunction,
|
|
24
|
-
ActorRef,
|
|
25
|
-
ActorRefFrom,
|
|
26
|
-
ActorRefFromLogic,
|
|
27
|
-
AnyActorLogic,
|
|
28
|
-
AnyActorRef,
|
|
29
|
-
AnyEventObject,
|
|
30
|
-
ConditionalRequired,
|
|
31
|
-
InputFrom,
|
|
32
|
-
IsNotNever,
|
|
33
|
-
MachineSnapshot,
|
|
34
|
-
MetaObject,
|
|
35
|
-
NonReducibleUnknown,
|
|
36
|
-
RequiredLogicInput,
|
|
37
|
-
StateMachine,
|
|
38
|
-
StateValue,
|
|
39
|
-
Values,
|
|
40
|
-
} from 'xstate'
|
|
41
|
-
import {GuardArgs} from 'xstate/guards'
|
|
42
|
-
import {InvalidValueResolution} from '..'
|
|
43
|
-
|
|
44
|
-
declare type AbstractBehaviorEvent =
|
|
45
|
-
| {
|
|
46
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'annotation.toggle'>
|
|
47
|
-
annotation: {
|
|
48
|
-
name: string
|
|
49
|
-
value: {
|
|
50
|
-
[prop: string]: unknown
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
| {
|
|
55
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.toggle'>
|
|
56
|
-
decorator: string
|
|
57
|
-
at?: {
|
|
58
|
-
anchor: BlockOffset
|
|
59
|
-
focus: BlockOffset
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
| {
|
|
63
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.backward'>
|
|
64
|
-
unit: 'character' | 'word' | 'line' | 'block'
|
|
65
|
-
}
|
|
66
|
-
| {
|
|
67
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.block'>
|
|
68
|
-
at: [KeyedSegment]
|
|
69
|
-
}
|
|
70
|
-
| {
|
|
71
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.forward'>
|
|
72
|
-
unit: 'character' | 'word' | 'line' | 'block'
|
|
73
|
-
}
|
|
74
|
-
| {
|
|
75
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete.text'>
|
|
76
|
-
at: {
|
|
77
|
-
anchor: BlockOffset
|
|
78
|
-
focus: BlockOffset
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
| {
|
|
82
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'deserialize'>
|
|
83
|
-
originEvent:
|
|
84
|
-
| PickFromUnion<
|
|
85
|
-
NativeBehaviorEvent,
|
|
86
|
-
'type',
|
|
87
|
-
'drag.drop' | 'clipboard.paste'
|
|
88
|
-
>
|
|
89
|
-
| InputBehaviorEvent
|
|
90
|
-
}
|
|
91
|
-
| {
|
|
92
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'serialize'>
|
|
93
|
-
originEvent: PickFromUnion<
|
|
94
|
-
NativeBehaviorEvent,
|
|
95
|
-
'type',
|
|
96
|
-
'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
97
|
-
>
|
|
98
|
-
}
|
|
99
|
-
| {
|
|
100
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.success'>
|
|
101
|
-
mimeType: MIMEType
|
|
102
|
-
data: Array<PortableTextBlock>
|
|
103
|
-
originEvent:
|
|
104
|
-
| PickFromUnion<
|
|
105
|
-
NativeBehaviorEvent,
|
|
106
|
-
'type',
|
|
107
|
-
'drag.drop' | 'clipboard.paste'
|
|
108
|
-
>
|
|
109
|
-
| InputBehaviorEvent
|
|
110
|
-
}
|
|
111
|
-
| {
|
|
112
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'deserialization.failure'>
|
|
113
|
-
mimeType: MIMEType
|
|
114
|
-
reason: string
|
|
115
|
-
originEvent:
|
|
116
|
-
| PickFromUnion<
|
|
117
|
-
NativeBehaviorEvent,
|
|
118
|
-
'type',
|
|
119
|
-
'drag.drop' | 'clipboard.paste'
|
|
120
|
-
>
|
|
121
|
-
| InputBehaviorEvent
|
|
122
|
-
}
|
|
123
|
-
| {
|
|
124
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'serialization.success'>
|
|
125
|
-
mimeType: MIMEType
|
|
126
|
-
data: string
|
|
127
|
-
originEvent: PickFromUnion<
|
|
128
|
-
NativeBehaviorEvent,
|
|
129
|
-
'type',
|
|
130
|
-
'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
131
|
-
>
|
|
132
|
-
}
|
|
133
|
-
| {
|
|
134
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'serialization.failure'>
|
|
135
|
-
mimeType: MIMEType
|
|
136
|
-
reason: string
|
|
137
|
-
originEvent: PickFromUnion<
|
|
138
|
-
NativeBehaviorEvent,
|
|
139
|
-
'type',
|
|
140
|
-
'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
141
|
-
>
|
|
142
|
-
}
|
|
143
|
-
| {
|
|
144
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.blocks'>
|
|
145
|
-
blocks: Array<BlockWithOptionalKey>
|
|
146
|
-
placement: InsertPlacement
|
|
147
|
-
}
|
|
148
|
-
| {
|
|
149
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.break'>
|
|
150
|
-
}
|
|
151
|
-
| {
|
|
152
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.soft break'>
|
|
153
|
-
}
|
|
154
|
-
| {
|
|
155
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'list item.add'>
|
|
156
|
-
listItem: string
|
|
157
|
-
}
|
|
158
|
-
| {
|
|
159
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'list item.remove'>
|
|
160
|
-
listItem: string
|
|
161
|
-
}
|
|
162
|
-
| {
|
|
163
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'list item.toggle'>
|
|
164
|
-
listItem: string
|
|
165
|
-
}
|
|
166
|
-
| {
|
|
167
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'move.block down'>
|
|
168
|
-
at: [KeyedSegment]
|
|
169
|
-
}
|
|
170
|
-
| {
|
|
171
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'move.block up'>
|
|
172
|
-
at: [KeyedSegment]
|
|
173
|
-
}
|
|
174
|
-
| {
|
|
175
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'select.previous block'>
|
|
176
|
-
select?: 'start' | 'end'
|
|
177
|
-
}
|
|
178
|
-
| {
|
|
179
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'select.next block'>
|
|
180
|
-
select?: 'start' | 'end'
|
|
181
|
-
}
|
|
182
|
-
| {
|
|
183
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'split'>
|
|
184
|
-
}
|
|
185
|
-
| {
|
|
186
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'style.add'>
|
|
187
|
-
style: string
|
|
188
|
-
}
|
|
189
|
-
| {
|
|
190
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'style.remove'>
|
|
191
|
-
style: string
|
|
192
|
-
}
|
|
193
|
-
| {
|
|
194
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'style.toggle'>
|
|
195
|
-
style: string
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**************************************
|
|
199
|
-
* Abstract events
|
|
200
|
-
**************************************/
|
|
201
|
-
declare const abstractBehaviorEventTypes: readonly [
|
|
202
|
-
'annotation.toggle',
|
|
203
|
-
'decorator.toggle',
|
|
204
|
-
'delete.backward',
|
|
205
|
-
'delete.block',
|
|
206
|
-
'delete.forward',
|
|
207
|
-
'delete.text',
|
|
208
|
-
'deserialize',
|
|
209
|
-
'deserialization.success',
|
|
210
|
-
'deserialization.failure',
|
|
211
|
-
'insert.blocks',
|
|
212
|
-
'insert.break',
|
|
213
|
-
'insert.soft break',
|
|
214
|
-
'list item.add',
|
|
215
|
-
'list item.remove',
|
|
216
|
-
'list item.toggle',
|
|
217
|
-
'move.block down',
|
|
218
|
-
'move.block up',
|
|
219
|
-
'select.previous block',
|
|
220
|
-
'select.next block',
|
|
221
|
-
'serialize',
|
|
222
|
-
'serialization.success',
|
|
223
|
-
'serialization.failure',
|
|
224
|
-
'split',
|
|
225
|
-
'style.add',
|
|
226
|
-
'style.remove',
|
|
227
|
-
'style.toggle',
|
|
228
|
-
]
|
|
229
9
|
|
|
230
10
|
/**
|
|
231
11
|
* @public
|
|
@@ -235,96 +15,6 @@ declare type BaseDefinition = {
|
|
|
235
15
|
title?: string
|
|
236
16
|
}
|
|
237
17
|
|
|
238
|
-
/**
|
|
239
|
-
* @beta
|
|
240
|
-
*/
|
|
241
|
-
declare type Behavior<
|
|
242
|
-
TBehaviorEventType extends
|
|
243
|
-
| '*'
|
|
244
|
-
| `${BehaviorEventTypeNamespace}.*`
|
|
245
|
-
| BehaviorEvent['type'] =
|
|
246
|
-
| '*'
|
|
247
|
-
| `${BehaviorEventTypeNamespace}.*`
|
|
248
|
-
| BehaviorEvent['type'],
|
|
249
|
-
TGuardResponse = true,
|
|
250
|
-
TBehaviorEvent extends
|
|
251
|
-
ResolveBehaviorEvent<TBehaviorEventType> = ResolveBehaviorEvent<TBehaviorEventType>,
|
|
252
|
-
> = {
|
|
253
|
-
/**
|
|
254
|
-
* Editor Event that triggers this Behavior.
|
|
255
|
-
*/
|
|
256
|
-
on: TBehaviorEventType
|
|
257
|
-
/**
|
|
258
|
-
* Predicate function that determines if the Behavior should be executed.
|
|
259
|
-
* Returning a non-nullable value from the guard will pass the value to the
|
|
260
|
-
* actions and execute them.
|
|
261
|
-
*/
|
|
262
|
-
guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>
|
|
263
|
-
/**
|
|
264
|
-
* Array of Behavior Action sets.
|
|
265
|
-
* Each set represents a step in the history stack.
|
|
266
|
-
*/
|
|
267
|
-
actions: Array<BehaviorActionSet<TBehaviorEvent, TGuardResponse>>
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* @beta
|
|
272
|
-
*/
|
|
273
|
-
declare type BehaviorAction =
|
|
274
|
-
| {
|
|
275
|
-
type: 'execute'
|
|
276
|
-
event: SyntheticBehaviorEvent
|
|
277
|
-
}
|
|
278
|
-
| {
|
|
279
|
-
type: 'forward'
|
|
280
|
-
event: NativeBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
281
|
-
}
|
|
282
|
-
| {
|
|
283
|
-
type: 'raise'
|
|
284
|
-
event: SyntheticBehaviorEvent | CustomBehaviorEvent
|
|
285
|
-
}
|
|
286
|
-
| {
|
|
287
|
-
type: 'effect'
|
|
288
|
-
effect: () => void
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* @beta
|
|
293
|
-
*/
|
|
294
|
-
declare type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
|
|
295
|
-
payload: {
|
|
296
|
-
snapshot: EditorSnapshot
|
|
297
|
-
event: TBehaviorEvent
|
|
298
|
-
},
|
|
299
|
-
guardResponse: TGuardResponse,
|
|
300
|
-
) => Array<BehaviorAction>
|
|
301
|
-
|
|
302
|
-
declare type BehaviorConfig = {
|
|
303
|
-
behavior: Behavior
|
|
304
|
-
priority: EditorPriority
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* @beta
|
|
309
|
-
*/
|
|
310
|
-
declare type BehaviorEvent =
|
|
311
|
-
| SyntheticBehaviorEvent
|
|
312
|
-
| NativeBehaviorEvent
|
|
313
|
-
| CustomBehaviorEvent
|
|
314
|
-
|
|
315
|
-
declare type BehaviorEventTypeNamespace =
|
|
316
|
-
| SyntheticBehaviorEventNamespace
|
|
317
|
-
| NativeBehaviorEventNamespace
|
|
318
|
-
| CustomBehaviorEventNamespace
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* @beta
|
|
322
|
-
*/
|
|
323
|
-
declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
324
|
-
snapshot: EditorSnapshot
|
|
325
|
-
event: TBehaviorEvent
|
|
326
|
-
}) => TGuardResponse | false
|
|
327
|
-
|
|
328
18
|
/**
|
|
329
19
|
* @beta
|
|
330
20
|
*/
|
|
@@ -391,10 +81,6 @@ export declare function blockOffsetToSpanSelectionPoint({
|
|
|
391
81
|
}
|
|
392
82
|
| undefined
|
|
393
83
|
|
|
394
|
-
declare type BlockWithOptionalKey =
|
|
395
|
-
| TextBlockWithOptionalKey
|
|
396
|
-
| ObjectBlockWithOptionalKey
|
|
397
|
-
|
|
398
84
|
/**
|
|
399
85
|
* @public
|
|
400
86
|
*/
|
|
@@ -406,29 +92,6 @@ export declare function childSelectionPointToBlockOffset({
|
|
|
406
92
|
selectionPoint: EditorSelectionPoint
|
|
407
93
|
}): BlockOffset | undefined
|
|
408
94
|
|
|
409
|
-
declare type ClipboardBehaviorEvent =
|
|
410
|
-
| {
|
|
411
|
-
type: StrictExtract<NativeBehaviorEventType, 'clipboard.copy'>
|
|
412
|
-
originEvent: {
|
|
413
|
-
dataTransfer: DataTransfer
|
|
414
|
-
}
|
|
415
|
-
position: Pick<EventPosition, 'selection'>
|
|
416
|
-
}
|
|
417
|
-
| {
|
|
418
|
-
type: StrictExtract<NativeBehaviorEventType, 'clipboard.cut'>
|
|
419
|
-
originEvent: {
|
|
420
|
-
dataTransfer: DataTransfer
|
|
421
|
-
}
|
|
422
|
-
position: Pick<EventPosition, 'selection'>
|
|
423
|
-
}
|
|
424
|
-
| {
|
|
425
|
-
type: StrictExtract<NativeBehaviorEventType, 'clipboard.paste'>
|
|
426
|
-
originEvent: {
|
|
427
|
-
dataTransfer: DataTransfer
|
|
428
|
-
}
|
|
429
|
-
position: Pick<EventPosition, 'selection'>
|
|
430
|
-
}
|
|
431
|
-
|
|
432
95
|
declare type Converter<TMIMEType extends MIMEType = MIMEType> = {
|
|
433
96
|
mimeType: TMIMEType
|
|
434
97
|
serialize: Serializer<TMIMEType>
|
|
@@ -467,30 +130,6 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
|
467
130
|
mimeType: TMIMEType
|
|
468
131
|
}
|
|
469
132
|
|
|
470
|
-
/**
|
|
471
|
-
* @beta
|
|
472
|
-
*/
|
|
473
|
-
declare type CustomBehaviorEvent<
|
|
474
|
-
TPayload extends Record<string, unknown> = Record<string, unknown>,
|
|
475
|
-
TType extends string = string,
|
|
476
|
-
TInternalType extends CustomBehaviorEventType<
|
|
477
|
-
'custom',
|
|
478
|
-
TType
|
|
479
|
-
> = CustomBehaviorEventType<'custom', TType>,
|
|
480
|
-
> = {
|
|
481
|
-
type: TInternalType
|
|
482
|
-
} & TPayload
|
|
483
|
-
|
|
484
|
-
/**************************************
|
|
485
|
-
* Custom events
|
|
486
|
-
**************************************/
|
|
487
|
-
declare type CustomBehaviorEventNamespace = 'custom'
|
|
488
|
-
|
|
489
|
-
declare type CustomBehaviorEventType<
|
|
490
|
-
TNamespace extends CustomBehaviorEventNamespace,
|
|
491
|
-
TType extends string = '',
|
|
492
|
-
> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
|
|
493
|
-
|
|
494
133
|
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
495
134
|
snapshot,
|
|
496
135
|
event,
|
|
@@ -503,148 +142,6 @@ declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
|
503
142
|
'deserialization.success' | 'deserialization.failure'
|
|
504
143
|
>
|
|
505
144
|
|
|
506
|
-
declare type DragBehaviorEvent =
|
|
507
|
-
| {
|
|
508
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
|
|
509
|
-
originEvent: {
|
|
510
|
-
dataTransfer: DataTransfer
|
|
511
|
-
}
|
|
512
|
-
position: Pick<EventPosition, 'selection'>
|
|
513
|
-
}
|
|
514
|
-
| {
|
|
515
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.drag'>
|
|
516
|
-
originEvent: {
|
|
517
|
-
dataTransfer: DataTransfer
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
| {
|
|
521
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.dragend'>
|
|
522
|
-
originEvent: {
|
|
523
|
-
dataTransfer: DataTransfer
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
| {
|
|
527
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.dragenter'>
|
|
528
|
-
originEvent: {
|
|
529
|
-
dataTransfer: DataTransfer
|
|
530
|
-
}
|
|
531
|
-
position: EventPosition
|
|
532
|
-
}
|
|
533
|
-
| {
|
|
534
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.dragover'>
|
|
535
|
-
originEvent: {
|
|
536
|
-
dataTransfer: DataTransfer
|
|
537
|
-
}
|
|
538
|
-
position: EventPosition
|
|
539
|
-
}
|
|
540
|
-
| {
|
|
541
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.drop'>
|
|
542
|
-
originEvent: {
|
|
543
|
-
dataTransfer: DataTransfer
|
|
544
|
-
}
|
|
545
|
-
position: EventPosition
|
|
546
|
-
}
|
|
547
|
-
| {
|
|
548
|
-
type: StrictExtract<NativeBehaviorEventType, 'drag.dragleave'>
|
|
549
|
-
originEvent: {
|
|
550
|
-
dataTransfer: DataTransfer
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
/** @beta */
|
|
555
|
-
declare interface EditableAPI {
|
|
556
|
-
activeAnnotations: () => PortableTextObject[]
|
|
557
|
-
isAnnotationActive: (annotationType: PortableTextObject['_type']) => boolean
|
|
558
|
-
addAnnotation: <
|
|
559
|
-
TSchemaType extends {
|
|
560
|
-
name: string
|
|
561
|
-
},
|
|
562
|
-
>(
|
|
563
|
-
type: TSchemaType,
|
|
564
|
-
value?: {
|
|
565
|
-
[prop: string]: unknown
|
|
566
|
-
},
|
|
567
|
-
) =>
|
|
568
|
-
| {
|
|
569
|
-
markDefPath: Path
|
|
570
|
-
markDefPaths: Array<Path>
|
|
571
|
-
spanPath: Path
|
|
572
|
-
}
|
|
573
|
-
| undefined
|
|
574
|
-
blur: () => void
|
|
575
|
-
delete: (
|
|
576
|
-
selection: EditorSelection,
|
|
577
|
-
options?: EditableAPIDeleteOptions,
|
|
578
|
-
) => void
|
|
579
|
-
findByPath: (
|
|
580
|
-
path: Path,
|
|
581
|
-
) => [PortableTextBlock | PortableTextChild | undefined, Path | undefined]
|
|
582
|
-
findDOMNode: (
|
|
583
|
-
element: PortableTextBlock | PortableTextChild,
|
|
584
|
-
) => DOMNode | undefined
|
|
585
|
-
focus: () => void
|
|
586
|
-
focusBlock: () => PortableTextBlock | undefined
|
|
587
|
-
focusChild: () => PortableTextChild | undefined
|
|
588
|
-
getSelection: () => EditorSelection
|
|
589
|
-
getFragment: () => PortableTextBlock[] | undefined
|
|
590
|
-
getValue: () => PortableTextBlock[] | undefined
|
|
591
|
-
hasBlockStyle: (style: string) => boolean
|
|
592
|
-
hasListStyle: (listStyle: string) => boolean
|
|
593
|
-
insertBlock: <
|
|
594
|
-
TSchemaType extends {
|
|
595
|
-
name: string
|
|
596
|
-
},
|
|
597
|
-
>(
|
|
598
|
-
type: TSchemaType,
|
|
599
|
-
value?: {
|
|
600
|
-
[prop: string]: unknown
|
|
601
|
-
},
|
|
602
|
-
) => Path
|
|
603
|
-
insertChild: <
|
|
604
|
-
TSchemaType extends {
|
|
605
|
-
name: string
|
|
606
|
-
},
|
|
607
|
-
>(
|
|
608
|
-
type: TSchemaType,
|
|
609
|
-
value?: {
|
|
610
|
-
[prop: string]: unknown
|
|
611
|
-
},
|
|
612
|
-
) => Path
|
|
613
|
-
insertBreak: () => void
|
|
614
|
-
isCollapsedSelection: () => boolean
|
|
615
|
-
isExpandedSelection: () => boolean
|
|
616
|
-
isMarkActive: (mark: string) => boolean
|
|
617
|
-
isSelectionsOverlapping: (
|
|
618
|
-
selectionA: EditorSelection,
|
|
619
|
-
selectionB: EditorSelection,
|
|
620
|
-
) => boolean
|
|
621
|
-
isVoid: (element: PortableTextBlock | PortableTextChild) => boolean
|
|
622
|
-
marks: () => string[]
|
|
623
|
-
redo: () => void
|
|
624
|
-
removeAnnotation: <
|
|
625
|
-
TSchemaType extends {
|
|
626
|
-
name: string
|
|
627
|
-
},
|
|
628
|
-
>(
|
|
629
|
-
type: TSchemaType,
|
|
630
|
-
) => void
|
|
631
|
-
select: (selection: EditorSelection) => void
|
|
632
|
-
toggleBlockStyle: (blockStyle: string) => void
|
|
633
|
-
toggleList: (listStyle: string) => void
|
|
634
|
-
toggleMark: (mark: string) => void
|
|
635
|
-
undo: () => void
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
/** @beta */
|
|
639
|
-
declare interface EditableAPIDeleteOptions {
|
|
640
|
-
mode?: 'blocks' | 'children' | 'selected'
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* @internal
|
|
645
|
-
*/
|
|
646
|
-
declare type EditorActor = ActorRefFrom<typeof editorMachine>
|
|
647
|
-
|
|
648
145
|
/**
|
|
649
146
|
* @public
|
|
650
147
|
*/
|
|
@@ -657,1764 +154,6 @@ declare type EditorContext = {
|
|
|
657
154
|
value: Array<PortableTextBlock>
|
|
658
155
|
}
|
|
659
156
|
|
|
660
|
-
/**
|
|
661
|
-
* @internal
|
|
662
|
-
*/
|
|
663
|
-
declare const editorMachine: StateMachine<
|
|
664
|
-
{
|
|
665
|
-
behaviors: Set<BehaviorConfig>
|
|
666
|
-
converters: Set<Converter>
|
|
667
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
668
|
-
keyGenerator: () => string
|
|
669
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
670
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
671
|
-
schema: EditorSchema
|
|
672
|
-
initialReadOnly: boolean
|
|
673
|
-
maxBlocks: number | undefined
|
|
674
|
-
selection: EditorSelection
|
|
675
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
676
|
-
internalDrag?: {
|
|
677
|
-
ghost?: HTMLElement
|
|
678
|
-
origin: Pick<EventPosition, 'selection'>
|
|
679
|
-
}
|
|
680
|
-
slateEditor?: PortableTextSlateEditor
|
|
681
|
-
},
|
|
682
|
-
| InternalPatchEvent
|
|
683
|
-
| MutationEvent
|
|
684
|
-
| PatchesEvent
|
|
685
|
-
| {
|
|
686
|
-
type: 'update readOnly'
|
|
687
|
-
readOnly: boolean
|
|
688
|
-
}
|
|
689
|
-
| {
|
|
690
|
-
type: 'update maxBlocks'
|
|
691
|
-
maxBlocks: number | undefined
|
|
692
|
-
}
|
|
693
|
-
| {
|
|
694
|
-
type: 'add behavior'
|
|
695
|
-
behaviorConfig: BehaviorConfig
|
|
696
|
-
}
|
|
697
|
-
| {
|
|
698
|
-
type: 'remove behavior'
|
|
699
|
-
behaviorConfig: BehaviorConfig
|
|
700
|
-
}
|
|
701
|
-
| {
|
|
702
|
-
type: 'blur'
|
|
703
|
-
editor: PortableTextSlateEditor
|
|
704
|
-
}
|
|
705
|
-
| {
|
|
706
|
-
type: 'focus'
|
|
707
|
-
editor: PortableTextSlateEditor
|
|
708
|
-
}
|
|
709
|
-
| {
|
|
710
|
-
type: 'normalizing'
|
|
711
|
-
}
|
|
712
|
-
| {
|
|
713
|
-
type: 'update selection'
|
|
714
|
-
selection: EditorSelection
|
|
715
|
-
}
|
|
716
|
-
| {
|
|
717
|
-
type: 'done normalizing'
|
|
718
|
-
}
|
|
719
|
-
| {
|
|
720
|
-
type: 'done syncing value'
|
|
721
|
-
}
|
|
722
|
-
| {
|
|
723
|
-
type: 'syncing value'
|
|
724
|
-
}
|
|
725
|
-
| {
|
|
726
|
-
type: 'behavior event'
|
|
727
|
-
behaviorEvent: BehaviorEvent
|
|
728
|
-
editor: PortableTextSlateEditor
|
|
729
|
-
nativeEvent?: {
|
|
730
|
-
preventDefault: () => void
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
| {
|
|
734
|
-
type: 'dragstart'
|
|
735
|
-
origin: Pick<EventPosition, 'selection'>
|
|
736
|
-
ghost?: HTMLElement
|
|
737
|
-
}
|
|
738
|
-
| {
|
|
739
|
-
type: 'dragend'
|
|
740
|
-
}
|
|
741
|
-
| {
|
|
742
|
-
type: 'drop'
|
|
743
|
-
},
|
|
744
|
-
{},
|
|
745
|
-
never,
|
|
746
|
-
Values<{
|
|
747
|
-
'add behavior to context': {
|
|
748
|
-
type: 'add behavior to context'
|
|
749
|
-
params: NonReducibleUnknown
|
|
750
|
-
}
|
|
751
|
-
'remove behavior from context': {
|
|
752
|
-
type: 'remove behavior from context'
|
|
753
|
-
params: NonReducibleUnknown
|
|
754
|
-
}
|
|
755
|
-
'emit patch event': {
|
|
756
|
-
type: 'emit patch event'
|
|
757
|
-
params: NonReducibleUnknown
|
|
758
|
-
}
|
|
759
|
-
'emit mutation event': {
|
|
760
|
-
type: 'emit mutation event'
|
|
761
|
-
params: NonReducibleUnknown
|
|
762
|
-
}
|
|
763
|
-
'emit read only': {
|
|
764
|
-
type: 'emit read only'
|
|
765
|
-
params: NonReducibleUnknown
|
|
766
|
-
}
|
|
767
|
-
'emit editable': {
|
|
768
|
-
type: 'emit editable'
|
|
769
|
-
params: NonReducibleUnknown
|
|
770
|
-
}
|
|
771
|
-
'defer event': {
|
|
772
|
-
type: 'defer event'
|
|
773
|
-
params: NonReducibleUnknown
|
|
774
|
-
}
|
|
775
|
-
'emit pending events': {
|
|
776
|
-
type: 'emit pending events'
|
|
777
|
-
params: NonReducibleUnknown
|
|
778
|
-
}
|
|
779
|
-
'emit ready': {
|
|
780
|
-
type: 'emit ready'
|
|
781
|
-
params: NonReducibleUnknown
|
|
782
|
-
}
|
|
783
|
-
'clear pending events': {
|
|
784
|
-
type: 'clear pending events'
|
|
785
|
-
params: NonReducibleUnknown
|
|
786
|
-
}
|
|
787
|
-
'defer incoming patches': {
|
|
788
|
-
type: 'defer incoming patches'
|
|
789
|
-
params: NonReducibleUnknown
|
|
790
|
-
}
|
|
791
|
-
'emit pending incoming patches': {
|
|
792
|
-
type: 'emit pending incoming patches'
|
|
793
|
-
params: NonReducibleUnknown
|
|
794
|
-
}
|
|
795
|
-
'clear pending incoming patches': {
|
|
796
|
-
type: 'clear pending incoming patches'
|
|
797
|
-
params: NonReducibleUnknown
|
|
798
|
-
}
|
|
799
|
-
'handle blur': {
|
|
800
|
-
type: 'handle blur'
|
|
801
|
-
params: unknown
|
|
802
|
-
}
|
|
803
|
-
'handle focus': {
|
|
804
|
-
type: 'handle focus'
|
|
805
|
-
params: unknown
|
|
806
|
-
}
|
|
807
|
-
'handle behavior event': {
|
|
808
|
-
type: 'handle behavior event'
|
|
809
|
-
params: unknown
|
|
810
|
-
}
|
|
811
|
-
}>,
|
|
812
|
-
{
|
|
813
|
-
type: 'slate is busy'
|
|
814
|
-
params: unknown
|
|
815
|
-
},
|
|
816
|
-
never,
|
|
817
|
-
{
|
|
818
|
-
'edit mode':
|
|
819
|
-
| {
|
|
820
|
-
editable:
|
|
821
|
-
| 'dragging internally'
|
|
822
|
-
| 'idle'
|
|
823
|
-
| {
|
|
824
|
-
focusing: 'checking if busy' | 'busy'
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
| {
|
|
828
|
-
'read only': 'read only' | 'determine initial edit mode'
|
|
829
|
-
}
|
|
830
|
-
'setup':
|
|
831
|
-
| 'setting up'
|
|
832
|
-
| {
|
|
833
|
-
'set up': {
|
|
834
|
-
'value sync': 'syncing value' | 'idle'
|
|
835
|
-
'writing':
|
|
836
|
-
| 'dirty'
|
|
837
|
-
| {
|
|
838
|
-
pristine: 'normalizing' | 'idle'
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
},
|
|
843
|
-
'dragging internally',
|
|
844
|
-
{
|
|
845
|
-
converters?: Array<Converter>
|
|
846
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
847
|
-
keyGenerator: () => string
|
|
848
|
-
maxBlocks?: number
|
|
849
|
-
readOnly?: boolean
|
|
850
|
-
schema: EditorSchema
|
|
851
|
-
initialValue?: Array<PortableTextBlock>
|
|
852
|
-
},
|
|
853
|
-
NonReducibleUnknown,
|
|
854
|
-
| InternalPatchEvent
|
|
855
|
-
| MutationEvent
|
|
856
|
-
| PatchesEvent
|
|
857
|
-
| {
|
|
858
|
-
type: 'blurred'
|
|
859
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
860
|
-
}
|
|
861
|
-
| {
|
|
862
|
-
type: 'done loading'
|
|
863
|
-
}
|
|
864
|
-
| {
|
|
865
|
-
type: 'editable'
|
|
866
|
-
}
|
|
867
|
-
| {
|
|
868
|
-
type: 'error'
|
|
869
|
-
name: string
|
|
870
|
-
description: string
|
|
871
|
-
data: unknown
|
|
872
|
-
}
|
|
873
|
-
| {
|
|
874
|
-
type: 'focused'
|
|
875
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
876
|
-
}
|
|
877
|
-
| {
|
|
878
|
-
type: 'invalid value'
|
|
879
|
-
resolution: InvalidValueResolution | null
|
|
880
|
-
value: Array<PortableTextBlock> | undefined
|
|
881
|
-
}
|
|
882
|
-
| {
|
|
883
|
-
type: 'loading'
|
|
884
|
-
}
|
|
885
|
-
| {
|
|
886
|
-
type: 'read only'
|
|
887
|
-
}
|
|
888
|
-
| {
|
|
889
|
-
type: 'ready'
|
|
890
|
-
}
|
|
891
|
-
| {
|
|
892
|
-
type: 'selection'
|
|
893
|
-
selection: EditorSelection
|
|
894
|
-
}
|
|
895
|
-
| {
|
|
896
|
-
type: 'value changed'
|
|
897
|
-
value: Array<PortableTextBlock> | undefined
|
|
898
|
-
},
|
|
899
|
-
MetaObject,
|
|
900
|
-
{
|
|
901
|
-
readonly id: 'editor'
|
|
902
|
-
readonly context: ({
|
|
903
|
-
input,
|
|
904
|
-
}: {
|
|
905
|
-
spawn: {
|
|
906
|
-
<TSrc extends never>(
|
|
907
|
-
logic: TSrc,
|
|
908
|
-
...[options]: never
|
|
909
|
-
): ActorRefFromLogic<never>
|
|
910
|
-
<TLogic extends AnyActorLogic>(
|
|
911
|
-
src: TLogic,
|
|
912
|
-
...[options]: ConditionalRequired<
|
|
913
|
-
[
|
|
914
|
-
options?:
|
|
915
|
-
| ({
|
|
916
|
-
id?: never
|
|
917
|
-
systemId?: string
|
|
918
|
-
input?: InputFrom<TLogic> | undefined
|
|
919
|
-
syncSnapshot?: boolean
|
|
920
|
-
} & {[K in RequiredLogicInput<TLogic>]: unknown})
|
|
921
|
-
| undefined,
|
|
922
|
-
],
|
|
923
|
-
IsNotNever<RequiredLogicInput<TLogic>>
|
|
924
|
-
>
|
|
925
|
-
): ActorRefFromLogic<TLogic>
|
|
926
|
-
}
|
|
927
|
-
input: {
|
|
928
|
-
converters?: Array<Converter>
|
|
929
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
930
|
-
keyGenerator: () => string
|
|
931
|
-
maxBlocks?: number
|
|
932
|
-
readOnly?: boolean
|
|
933
|
-
schema: EditorSchema
|
|
934
|
-
initialValue?: Array<PortableTextBlock>
|
|
935
|
-
}
|
|
936
|
-
self: ActorRef<
|
|
937
|
-
MachineSnapshot<
|
|
938
|
-
{
|
|
939
|
-
behaviors: Set<BehaviorConfig>
|
|
940
|
-
converters: Set<Converter>
|
|
941
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
942
|
-
keyGenerator: () => string
|
|
943
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
944
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
945
|
-
schema: EditorSchema
|
|
946
|
-
initialReadOnly: boolean
|
|
947
|
-
maxBlocks: number | undefined
|
|
948
|
-
selection: EditorSelection
|
|
949
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
950
|
-
internalDrag?: {
|
|
951
|
-
ghost?: HTMLElement
|
|
952
|
-
origin: Pick<EventPosition, 'selection'>
|
|
953
|
-
}
|
|
954
|
-
slateEditor?: PortableTextSlateEditor
|
|
955
|
-
},
|
|
956
|
-
| InternalPatchEvent
|
|
957
|
-
| MutationEvent
|
|
958
|
-
| PatchesEvent
|
|
959
|
-
| {
|
|
960
|
-
type: 'update readOnly'
|
|
961
|
-
readOnly: boolean
|
|
962
|
-
}
|
|
963
|
-
| {
|
|
964
|
-
type: 'update maxBlocks'
|
|
965
|
-
maxBlocks: number | undefined
|
|
966
|
-
}
|
|
967
|
-
| {
|
|
968
|
-
type: 'add behavior'
|
|
969
|
-
behaviorConfig: BehaviorConfig
|
|
970
|
-
}
|
|
971
|
-
| {
|
|
972
|
-
type: 'remove behavior'
|
|
973
|
-
behaviorConfig: BehaviorConfig
|
|
974
|
-
}
|
|
975
|
-
| {
|
|
976
|
-
type: 'blur'
|
|
977
|
-
editor: PortableTextSlateEditor
|
|
978
|
-
}
|
|
979
|
-
| {
|
|
980
|
-
type: 'focus'
|
|
981
|
-
editor: PortableTextSlateEditor
|
|
982
|
-
}
|
|
983
|
-
| {
|
|
984
|
-
type: 'normalizing'
|
|
985
|
-
}
|
|
986
|
-
| {
|
|
987
|
-
type: 'update selection'
|
|
988
|
-
selection: EditorSelection
|
|
989
|
-
}
|
|
990
|
-
| {
|
|
991
|
-
type: 'done normalizing'
|
|
992
|
-
}
|
|
993
|
-
| {
|
|
994
|
-
type: 'done syncing value'
|
|
995
|
-
}
|
|
996
|
-
| {
|
|
997
|
-
type: 'syncing value'
|
|
998
|
-
}
|
|
999
|
-
| {
|
|
1000
|
-
type: 'behavior event'
|
|
1001
|
-
behaviorEvent: BehaviorEvent
|
|
1002
|
-
editor: PortableTextSlateEditor
|
|
1003
|
-
nativeEvent?: {
|
|
1004
|
-
preventDefault: () => void
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
| {
|
|
1008
|
-
type: 'dragstart'
|
|
1009
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1010
|
-
ghost?: HTMLElement
|
|
1011
|
-
}
|
|
1012
|
-
| {
|
|
1013
|
-
type: 'dragend'
|
|
1014
|
-
}
|
|
1015
|
-
| {
|
|
1016
|
-
type: 'drop'
|
|
1017
|
-
},
|
|
1018
|
-
Record<string, AnyActorRef | undefined>,
|
|
1019
|
-
StateValue,
|
|
1020
|
-
string,
|
|
1021
|
-
unknown,
|
|
1022
|
-
any,
|
|
1023
|
-
any
|
|
1024
|
-
>,
|
|
1025
|
-
| InternalPatchEvent
|
|
1026
|
-
| MutationEvent
|
|
1027
|
-
| PatchesEvent
|
|
1028
|
-
| {
|
|
1029
|
-
type: 'update readOnly'
|
|
1030
|
-
readOnly: boolean
|
|
1031
|
-
}
|
|
1032
|
-
| {
|
|
1033
|
-
type: 'update maxBlocks'
|
|
1034
|
-
maxBlocks: number | undefined
|
|
1035
|
-
}
|
|
1036
|
-
| {
|
|
1037
|
-
type: 'add behavior'
|
|
1038
|
-
behaviorConfig: BehaviorConfig
|
|
1039
|
-
}
|
|
1040
|
-
| {
|
|
1041
|
-
type: 'remove behavior'
|
|
1042
|
-
behaviorConfig: BehaviorConfig
|
|
1043
|
-
}
|
|
1044
|
-
| {
|
|
1045
|
-
type: 'blur'
|
|
1046
|
-
editor: PortableTextSlateEditor
|
|
1047
|
-
}
|
|
1048
|
-
| {
|
|
1049
|
-
type: 'focus'
|
|
1050
|
-
editor: PortableTextSlateEditor
|
|
1051
|
-
}
|
|
1052
|
-
| {
|
|
1053
|
-
type: 'normalizing'
|
|
1054
|
-
}
|
|
1055
|
-
| {
|
|
1056
|
-
type: 'update selection'
|
|
1057
|
-
selection: EditorSelection
|
|
1058
|
-
}
|
|
1059
|
-
| {
|
|
1060
|
-
type: 'done normalizing'
|
|
1061
|
-
}
|
|
1062
|
-
| {
|
|
1063
|
-
type: 'done syncing value'
|
|
1064
|
-
}
|
|
1065
|
-
| {
|
|
1066
|
-
type: 'syncing value'
|
|
1067
|
-
}
|
|
1068
|
-
| {
|
|
1069
|
-
type: 'behavior event'
|
|
1070
|
-
behaviorEvent: BehaviorEvent
|
|
1071
|
-
editor: PortableTextSlateEditor
|
|
1072
|
-
nativeEvent?: {
|
|
1073
|
-
preventDefault: () => void
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
| {
|
|
1077
|
-
type: 'dragstart'
|
|
1078
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1079
|
-
ghost?: HTMLElement
|
|
1080
|
-
}
|
|
1081
|
-
| {
|
|
1082
|
-
type: 'dragend'
|
|
1083
|
-
}
|
|
1084
|
-
| {
|
|
1085
|
-
type: 'drop'
|
|
1086
|
-
},
|
|
1087
|
-
AnyEventObject
|
|
1088
|
-
>
|
|
1089
|
-
}) => {
|
|
1090
|
-
behaviors: Set<never>
|
|
1091
|
-
converters: Set<Converter>
|
|
1092
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1093
|
-
keyGenerator: () => string
|
|
1094
|
-
pendingEvents: never[]
|
|
1095
|
-
pendingIncomingPatchesEvents: never[]
|
|
1096
|
-
schema: EditorSchema
|
|
1097
|
-
selection: null
|
|
1098
|
-
initialReadOnly: boolean
|
|
1099
|
-
maxBlocks: number | undefined
|
|
1100
|
-
initialValue: PortableTextBlock[] | undefined
|
|
1101
|
-
}
|
|
1102
|
-
readonly on: {
|
|
1103
|
-
readonly 'add behavior': {
|
|
1104
|
-
readonly actions: 'add behavior to context'
|
|
1105
|
-
}
|
|
1106
|
-
readonly 'remove behavior': {
|
|
1107
|
-
readonly actions: 'remove behavior from context'
|
|
1108
|
-
}
|
|
1109
|
-
readonly 'update maxBlocks': {
|
|
1110
|
-
readonly actions: ActionFunction<
|
|
1111
|
-
{
|
|
1112
|
-
behaviors: Set<BehaviorConfig>
|
|
1113
|
-
converters: Set<Converter>
|
|
1114
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1115
|
-
keyGenerator: () => string
|
|
1116
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1117
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1118
|
-
schema: EditorSchema
|
|
1119
|
-
initialReadOnly: boolean
|
|
1120
|
-
maxBlocks: number | undefined
|
|
1121
|
-
selection: EditorSelection
|
|
1122
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1123
|
-
internalDrag?: {
|
|
1124
|
-
ghost?: HTMLElement
|
|
1125
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1126
|
-
}
|
|
1127
|
-
slateEditor?: PortableTextSlateEditor
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
type: 'update maxBlocks'
|
|
1131
|
-
maxBlocks: number | undefined
|
|
1132
|
-
},
|
|
1133
|
-
| InternalPatchEvent
|
|
1134
|
-
| MutationEvent
|
|
1135
|
-
| PatchesEvent
|
|
1136
|
-
| {
|
|
1137
|
-
type: 'update readOnly'
|
|
1138
|
-
readOnly: boolean
|
|
1139
|
-
}
|
|
1140
|
-
| {
|
|
1141
|
-
type: 'update maxBlocks'
|
|
1142
|
-
maxBlocks: number | undefined
|
|
1143
|
-
}
|
|
1144
|
-
| {
|
|
1145
|
-
type: 'add behavior'
|
|
1146
|
-
behaviorConfig: BehaviorConfig
|
|
1147
|
-
}
|
|
1148
|
-
| {
|
|
1149
|
-
type: 'remove behavior'
|
|
1150
|
-
behaviorConfig: BehaviorConfig
|
|
1151
|
-
}
|
|
1152
|
-
| {
|
|
1153
|
-
type: 'blur'
|
|
1154
|
-
editor: PortableTextSlateEditor
|
|
1155
|
-
}
|
|
1156
|
-
| {
|
|
1157
|
-
type: 'focus'
|
|
1158
|
-
editor: PortableTextSlateEditor
|
|
1159
|
-
}
|
|
1160
|
-
| {
|
|
1161
|
-
type: 'normalizing'
|
|
1162
|
-
}
|
|
1163
|
-
| {
|
|
1164
|
-
type: 'update selection'
|
|
1165
|
-
selection: EditorSelection
|
|
1166
|
-
}
|
|
1167
|
-
| {
|
|
1168
|
-
type: 'done normalizing'
|
|
1169
|
-
}
|
|
1170
|
-
| {
|
|
1171
|
-
type: 'done syncing value'
|
|
1172
|
-
}
|
|
1173
|
-
| {
|
|
1174
|
-
type: 'syncing value'
|
|
1175
|
-
}
|
|
1176
|
-
| {
|
|
1177
|
-
type: 'behavior event'
|
|
1178
|
-
behaviorEvent: BehaviorEvent
|
|
1179
|
-
editor: PortableTextSlateEditor
|
|
1180
|
-
nativeEvent?: {
|
|
1181
|
-
preventDefault: () => void
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
| {
|
|
1185
|
-
type: 'dragstart'
|
|
1186
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1187
|
-
ghost?: HTMLElement
|
|
1188
|
-
}
|
|
1189
|
-
| {
|
|
1190
|
-
type: 'dragend'
|
|
1191
|
-
}
|
|
1192
|
-
| {
|
|
1193
|
-
type: 'drop'
|
|
1194
|
-
},
|
|
1195
|
-
undefined,
|
|
1196
|
-
never,
|
|
1197
|
-
never,
|
|
1198
|
-
never,
|
|
1199
|
-
never,
|
|
1200
|
-
never
|
|
1201
|
-
>
|
|
1202
|
-
}
|
|
1203
|
-
readonly 'update selection': {
|
|
1204
|
-
readonly actions: readonly [
|
|
1205
|
-
ActionFunction<
|
|
1206
|
-
{
|
|
1207
|
-
behaviors: Set<BehaviorConfig>
|
|
1208
|
-
converters: Set<Converter>
|
|
1209
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1210
|
-
keyGenerator: () => string
|
|
1211
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1212
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1213
|
-
schema: EditorSchema
|
|
1214
|
-
initialReadOnly: boolean
|
|
1215
|
-
maxBlocks: number | undefined
|
|
1216
|
-
selection: EditorSelection
|
|
1217
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1218
|
-
internalDrag?: {
|
|
1219
|
-
ghost?: HTMLElement
|
|
1220
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1221
|
-
}
|
|
1222
|
-
slateEditor?: PortableTextSlateEditor
|
|
1223
|
-
},
|
|
1224
|
-
{
|
|
1225
|
-
type: 'update selection'
|
|
1226
|
-
selection: EditorSelection
|
|
1227
|
-
},
|
|
1228
|
-
| InternalPatchEvent
|
|
1229
|
-
| MutationEvent
|
|
1230
|
-
| PatchesEvent
|
|
1231
|
-
| {
|
|
1232
|
-
type: 'update readOnly'
|
|
1233
|
-
readOnly: boolean
|
|
1234
|
-
}
|
|
1235
|
-
| {
|
|
1236
|
-
type: 'update maxBlocks'
|
|
1237
|
-
maxBlocks: number | undefined
|
|
1238
|
-
}
|
|
1239
|
-
| {
|
|
1240
|
-
type: 'add behavior'
|
|
1241
|
-
behaviorConfig: BehaviorConfig
|
|
1242
|
-
}
|
|
1243
|
-
| {
|
|
1244
|
-
type: 'remove behavior'
|
|
1245
|
-
behaviorConfig: BehaviorConfig
|
|
1246
|
-
}
|
|
1247
|
-
| {
|
|
1248
|
-
type: 'blur'
|
|
1249
|
-
editor: PortableTextSlateEditor
|
|
1250
|
-
}
|
|
1251
|
-
| {
|
|
1252
|
-
type: 'focus'
|
|
1253
|
-
editor: PortableTextSlateEditor
|
|
1254
|
-
}
|
|
1255
|
-
| {
|
|
1256
|
-
type: 'normalizing'
|
|
1257
|
-
}
|
|
1258
|
-
| {
|
|
1259
|
-
type: 'update selection'
|
|
1260
|
-
selection: EditorSelection
|
|
1261
|
-
}
|
|
1262
|
-
| {
|
|
1263
|
-
type: 'done normalizing'
|
|
1264
|
-
}
|
|
1265
|
-
| {
|
|
1266
|
-
type: 'done syncing value'
|
|
1267
|
-
}
|
|
1268
|
-
| {
|
|
1269
|
-
type: 'syncing value'
|
|
1270
|
-
}
|
|
1271
|
-
| {
|
|
1272
|
-
type: 'behavior event'
|
|
1273
|
-
behaviorEvent: BehaviorEvent
|
|
1274
|
-
editor: PortableTextSlateEditor
|
|
1275
|
-
nativeEvent?: {
|
|
1276
|
-
preventDefault: () => void
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
| {
|
|
1280
|
-
type: 'dragstart'
|
|
1281
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1282
|
-
ghost?: HTMLElement
|
|
1283
|
-
}
|
|
1284
|
-
| {
|
|
1285
|
-
type: 'dragend'
|
|
1286
|
-
}
|
|
1287
|
-
| {
|
|
1288
|
-
type: 'drop'
|
|
1289
|
-
},
|
|
1290
|
-
undefined,
|
|
1291
|
-
never,
|
|
1292
|
-
never,
|
|
1293
|
-
never,
|
|
1294
|
-
never,
|
|
1295
|
-
never
|
|
1296
|
-
>,
|
|
1297
|
-
ActionFunction<
|
|
1298
|
-
{
|
|
1299
|
-
behaviors: Set<BehaviorConfig>
|
|
1300
|
-
converters: Set<Converter>
|
|
1301
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1302
|
-
keyGenerator: () => string
|
|
1303
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1304
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1305
|
-
schema: EditorSchema
|
|
1306
|
-
initialReadOnly: boolean
|
|
1307
|
-
maxBlocks: number | undefined
|
|
1308
|
-
selection: EditorSelection
|
|
1309
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1310
|
-
internalDrag?: {
|
|
1311
|
-
ghost?: HTMLElement
|
|
1312
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1313
|
-
}
|
|
1314
|
-
slateEditor?: PortableTextSlateEditor
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
type: 'update selection'
|
|
1318
|
-
selection: EditorSelection
|
|
1319
|
-
},
|
|
1320
|
-
| InternalPatchEvent
|
|
1321
|
-
| MutationEvent
|
|
1322
|
-
| PatchesEvent
|
|
1323
|
-
| {
|
|
1324
|
-
type: 'update readOnly'
|
|
1325
|
-
readOnly: boolean
|
|
1326
|
-
}
|
|
1327
|
-
| {
|
|
1328
|
-
type: 'update maxBlocks'
|
|
1329
|
-
maxBlocks: number | undefined
|
|
1330
|
-
}
|
|
1331
|
-
| {
|
|
1332
|
-
type: 'add behavior'
|
|
1333
|
-
behaviorConfig: BehaviorConfig
|
|
1334
|
-
}
|
|
1335
|
-
| {
|
|
1336
|
-
type: 'remove behavior'
|
|
1337
|
-
behaviorConfig: BehaviorConfig
|
|
1338
|
-
}
|
|
1339
|
-
| {
|
|
1340
|
-
type: 'blur'
|
|
1341
|
-
editor: PortableTextSlateEditor
|
|
1342
|
-
}
|
|
1343
|
-
| {
|
|
1344
|
-
type: 'focus'
|
|
1345
|
-
editor: PortableTextSlateEditor
|
|
1346
|
-
}
|
|
1347
|
-
| {
|
|
1348
|
-
type: 'normalizing'
|
|
1349
|
-
}
|
|
1350
|
-
| {
|
|
1351
|
-
type: 'update selection'
|
|
1352
|
-
selection: EditorSelection
|
|
1353
|
-
}
|
|
1354
|
-
| {
|
|
1355
|
-
type: 'done normalizing'
|
|
1356
|
-
}
|
|
1357
|
-
| {
|
|
1358
|
-
type: 'done syncing value'
|
|
1359
|
-
}
|
|
1360
|
-
| {
|
|
1361
|
-
type: 'syncing value'
|
|
1362
|
-
}
|
|
1363
|
-
| {
|
|
1364
|
-
type: 'behavior event'
|
|
1365
|
-
behaviorEvent: BehaviorEvent
|
|
1366
|
-
editor: PortableTextSlateEditor
|
|
1367
|
-
nativeEvent?: {
|
|
1368
|
-
preventDefault: () => void
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
| {
|
|
1372
|
-
type: 'dragstart'
|
|
1373
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1374
|
-
ghost?: HTMLElement
|
|
1375
|
-
}
|
|
1376
|
-
| {
|
|
1377
|
-
type: 'dragend'
|
|
1378
|
-
}
|
|
1379
|
-
| {
|
|
1380
|
-
type: 'drop'
|
|
1381
|
-
},
|
|
1382
|
-
undefined,
|
|
1383
|
-
never,
|
|
1384
|
-
never,
|
|
1385
|
-
never,
|
|
1386
|
-
never,
|
|
1387
|
-
| InternalPatchEvent
|
|
1388
|
-
| MutationEvent
|
|
1389
|
-
| PatchesEvent
|
|
1390
|
-
| {
|
|
1391
|
-
type: 'blurred'
|
|
1392
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
1393
|
-
}
|
|
1394
|
-
| {
|
|
1395
|
-
type: 'done loading'
|
|
1396
|
-
}
|
|
1397
|
-
| {
|
|
1398
|
-
type: 'editable'
|
|
1399
|
-
}
|
|
1400
|
-
| {
|
|
1401
|
-
type: 'error'
|
|
1402
|
-
name: string
|
|
1403
|
-
description: string
|
|
1404
|
-
data: unknown
|
|
1405
|
-
}
|
|
1406
|
-
| {
|
|
1407
|
-
type: 'focused'
|
|
1408
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
1409
|
-
}
|
|
1410
|
-
| {
|
|
1411
|
-
type: 'invalid value'
|
|
1412
|
-
resolution: InvalidValueResolution | null
|
|
1413
|
-
value: Array<PortableTextBlock> | undefined
|
|
1414
|
-
}
|
|
1415
|
-
| {
|
|
1416
|
-
type: 'loading'
|
|
1417
|
-
}
|
|
1418
|
-
| {
|
|
1419
|
-
type: 'read only'
|
|
1420
|
-
}
|
|
1421
|
-
| {
|
|
1422
|
-
type: 'ready'
|
|
1423
|
-
}
|
|
1424
|
-
| {
|
|
1425
|
-
type: 'selection'
|
|
1426
|
-
selection: EditorSelection
|
|
1427
|
-
}
|
|
1428
|
-
| {
|
|
1429
|
-
type: 'value changed'
|
|
1430
|
-
value: Array<PortableTextBlock> | undefined
|
|
1431
|
-
}
|
|
1432
|
-
>,
|
|
1433
|
-
]
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
readonly type: 'parallel'
|
|
1437
|
-
readonly states: {
|
|
1438
|
-
readonly 'edit mode': {
|
|
1439
|
-
readonly initial: 'read only'
|
|
1440
|
-
readonly states: {
|
|
1441
|
-
readonly 'read only': {
|
|
1442
|
-
readonly initial: 'determine initial edit mode'
|
|
1443
|
-
readonly on: {
|
|
1444
|
-
readonly 'behavior event': {
|
|
1445
|
-
readonly actions: 'handle behavior event'
|
|
1446
|
-
readonly guard: ({
|
|
1447
|
-
event,
|
|
1448
|
-
}: GuardArgs<
|
|
1449
|
-
{
|
|
1450
|
-
behaviors: Set<BehaviorConfig>
|
|
1451
|
-
converters: Set<Converter>
|
|
1452
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1453
|
-
keyGenerator: () => string
|
|
1454
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1455
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1456
|
-
schema: EditorSchema
|
|
1457
|
-
initialReadOnly: boolean
|
|
1458
|
-
maxBlocks: number | undefined
|
|
1459
|
-
selection: EditorSelection
|
|
1460
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1461
|
-
internalDrag?: {
|
|
1462
|
-
ghost?: HTMLElement
|
|
1463
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1464
|
-
}
|
|
1465
|
-
slateEditor?: PortableTextSlateEditor
|
|
1466
|
-
},
|
|
1467
|
-
{
|
|
1468
|
-
type: 'behavior event'
|
|
1469
|
-
behaviorEvent: BehaviorEvent
|
|
1470
|
-
editor: PortableTextSlateEditor
|
|
1471
|
-
nativeEvent?: {
|
|
1472
|
-
preventDefault: () => void
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
>) => boolean
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
readonly states: {
|
|
1479
|
-
readonly 'determine initial edit mode': {
|
|
1480
|
-
readonly entry: readonly [() => void]
|
|
1481
|
-
readonly exit: readonly [() => void]
|
|
1482
|
-
readonly on: {
|
|
1483
|
-
readonly 'done syncing value': readonly [
|
|
1484
|
-
{
|
|
1485
|
-
readonly target: '#editor.edit mode.read only.read only'
|
|
1486
|
-
readonly guard: ({
|
|
1487
|
-
context,
|
|
1488
|
-
}: GuardArgs<
|
|
1489
|
-
{
|
|
1490
|
-
behaviors: Set<BehaviorConfig>
|
|
1491
|
-
converters: Set<Converter>
|
|
1492
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1493
|
-
keyGenerator: () => string
|
|
1494
|
-
pendingEvents: Array<
|
|
1495
|
-
InternalPatchEvent | MutationEvent
|
|
1496
|
-
>
|
|
1497
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1498
|
-
schema: EditorSchema
|
|
1499
|
-
initialReadOnly: boolean
|
|
1500
|
-
maxBlocks: number | undefined
|
|
1501
|
-
selection: EditorSelection
|
|
1502
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1503
|
-
internalDrag?: {
|
|
1504
|
-
ghost?: HTMLElement
|
|
1505
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1506
|
-
}
|
|
1507
|
-
slateEditor?: PortableTextSlateEditor
|
|
1508
|
-
},
|
|
1509
|
-
{
|
|
1510
|
-
type: 'done syncing value'
|
|
1511
|
-
}
|
|
1512
|
-
>) => boolean
|
|
1513
|
-
},
|
|
1514
|
-
{
|
|
1515
|
-
readonly target: '#editor.edit mode.editable'
|
|
1516
|
-
},
|
|
1517
|
-
]
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
readonly 'read only': {
|
|
1521
|
-
readonly entry: readonly [() => void]
|
|
1522
|
-
readonly exit: readonly [() => void]
|
|
1523
|
-
readonly on: {
|
|
1524
|
-
readonly 'update readOnly': {
|
|
1525
|
-
readonly guard: ({
|
|
1526
|
-
event,
|
|
1527
|
-
}: GuardArgs<
|
|
1528
|
-
{
|
|
1529
|
-
behaviors: Set<BehaviorConfig>
|
|
1530
|
-
converters: Set<Converter>
|
|
1531
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1532
|
-
keyGenerator: () => string
|
|
1533
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1534
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1535
|
-
schema: EditorSchema
|
|
1536
|
-
initialReadOnly: boolean
|
|
1537
|
-
maxBlocks: number | undefined
|
|
1538
|
-
selection: EditorSelection
|
|
1539
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1540
|
-
internalDrag?: {
|
|
1541
|
-
ghost?: HTMLElement
|
|
1542
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1543
|
-
}
|
|
1544
|
-
slateEditor?: PortableTextSlateEditor
|
|
1545
|
-
},
|
|
1546
|
-
{
|
|
1547
|
-
type: 'update readOnly'
|
|
1548
|
-
readOnly: boolean
|
|
1549
|
-
}
|
|
1550
|
-
>) => boolean
|
|
1551
|
-
readonly target: '#editor.edit mode.editable'
|
|
1552
|
-
readonly actions: readonly ['emit editable']
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
readonly 'editable': {
|
|
1559
|
-
readonly on: {
|
|
1560
|
-
readonly 'update readOnly': {
|
|
1561
|
-
readonly guard: ({
|
|
1562
|
-
event,
|
|
1563
|
-
}: GuardArgs<
|
|
1564
|
-
{
|
|
1565
|
-
behaviors: Set<BehaviorConfig>
|
|
1566
|
-
converters: Set<Converter>
|
|
1567
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1568
|
-
keyGenerator: () => string
|
|
1569
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1570
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1571
|
-
schema: EditorSchema
|
|
1572
|
-
initialReadOnly: boolean
|
|
1573
|
-
maxBlocks: number | undefined
|
|
1574
|
-
selection: EditorSelection
|
|
1575
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1576
|
-
internalDrag?: {
|
|
1577
|
-
ghost?: HTMLElement
|
|
1578
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1579
|
-
}
|
|
1580
|
-
slateEditor?: PortableTextSlateEditor
|
|
1581
|
-
},
|
|
1582
|
-
{
|
|
1583
|
-
type: 'update readOnly'
|
|
1584
|
-
readOnly: boolean
|
|
1585
|
-
}
|
|
1586
|
-
>) => boolean
|
|
1587
|
-
readonly target: '#editor.edit mode.read only.read only'
|
|
1588
|
-
readonly actions: readonly ['emit read only']
|
|
1589
|
-
}
|
|
1590
|
-
readonly 'behavior event': {
|
|
1591
|
-
readonly actions: 'handle behavior event'
|
|
1592
|
-
}
|
|
1593
|
-
readonly 'blur': {
|
|
1594
|
-
readonly actions: 'handle blur'
|
|
1595
|
-
}
|
|
1596
|
-
readonly 'focus': {
|
|
1597
|
-
readonly target: '.focusing'
|
|
1598
|
-
readonly actions: readonly [
|
|
1599
|
-
ActionFunction<
|
|
1600
|
-
{
|
|
1601
|
-
behaviors: Set<BehaviorConfig>
|
|
1602
|
-
converters: Set<Converter>
|
|
1603
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1604
|
-
keyGenerator: () => string
|
|
1605
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1606
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1607
|
-
schema: EditorSchema
|
|
1608
|
-
initialReadOnly: boolean
|
|
1609
|
-
maxBlocks: number | undefined
|
|
1610
|
-
selection: EditorSelection
|
|
1611
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1612
|
-
internalDrag?: {
|
|
1613
|
-
ghost?: HTMLElement
|
|
1614
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1615
|
-
}
|
|
1616
|
-
slateEditor?: PortableTextSlateEditor
|
|
1617
|
-
},
|
|
1618
|
-
{
|
|
1619
|
-
type: 'focus'
|
|
1620
|
-
editor: PortableTextSlateEditor
|
|
1621
|
-
},
|
|
1622
|
-
| InternalPatchEvent
|
|
1623
|
-
| MutationEvent
|
|
1624
|
-
| PatchesEvent
|
|
1625
|
-
| {
|
|
1626
|
-
type: 'update readOnly'
|
|
1627
|
-
readOnly: boolean
|
|
1628
|
-
}
|
|
1629
|
-
| {
|
|
1630
|
-
type: 'update maxBlocks'
|
|
1631
|
-
maxBlocks: number | undefined
|
|
1632
|
-
}
|
|
1633
|
-
| {
|
|
1634
|
-
type: 'add behavior'
|
|
1635
|
-
behaviorConfig: BehaviorConfig
|
|
1636
|
-
}
|
|
1637
|
-
| {
|
|
1638
|
-
type: 'remove behavior'
|
|
1639
|
-
behaviorConfig: BehaviorConfig
|
|
1640
|
-
}
|
|
1641
|
-
| {
|
|
1642
|
-
type: 'blur'
|
|
1643
|
-
editor: PortableTextSlateEditor
|
|
1644
|
-
}
|
|
1645
|
-
| {
|
|
1646
|
-
type: 'focus'
|
|
1647
|
-
editor: PortableTextSlateEditor
|
|
1648
|
-
}
|
|
1649
|
-
| {
|
|
1650
|
-
type: 'normalizing'
|
|
1651
|
-
}
|
|
1652
|
-
| {
|
|
1653
|
-
type: 'update selection'
|
|
1654
|
-
selection: EditorSelection
|
|
1655
|
-
}
|
|
1656
|
-
| {
|
|
1657
|
-
type: 'done normalizing'
|
|
1658
|
-
}
|
|
1659
|
-
| {
|
|
1660
|
-
type: 'done syncing value'
|
|
1661
|
-
}
|
|
1662
|
-
| {
|
|
1663
|
-
type: 'syncing value'
|
|
1664
|
-
}
|
|
1665
|
-
| {
|
|
1666
|
-
type: 'behavior event'
|
|
1667
|
-
behaviorEvent: BehaviorEvent
|
|
1668
|
-
editor: PortableTextSlateEditor
|
|
1669
|
-
nativeEvent?: {
|
|
1670
|
-
preventDefault: () => void
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
| {
|
|
1674
|
-
type: 'dragstart'
|
|
1675
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1676
|
-
ghost?: HTMLElement
|
|
1677
|
-
}
|
|
1678
|
-
| {
|
|
1679
|
-
type: 'dragend'
|
|
1680
|
-
}
|
|
1681
|
-
| {
|
|
1682
|
-
type: 'drop'
|
|
1683
|
-
},
|
|
1684
|
-
undefined,
|
|
1685
|
-
never,
|
|
1686
|
-
never,
|
|
1687
|
-
never,
|
|
1688
|
-
never,
|
|
1689
|
-
never
|
|
1690
|
-
>,
|
|
1691
|
-
]
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
readonly initial: 'idle'
|
|
1695
|
-
readonly states: {
|
|
1696
|
-
readonly 'idle': {
|
|
1697
|
-
readonly entry: readonly [() => void]
|
|
1698
|
-
readonly exit: readonly [() => void]
|
|
1699
|
-
readonly on: {
|
|
1700
|
-
readonly dragstart: {
|
|
1701
|
-
readonly actions: readonly [
|
|
1702
|
-
ActionFunction<
|
|
1703
|
-
{
|
|
1704
|
-
behaviors: Set<BehaviorConfig>
|
|
1705
|
-
converters: Set<Converter>
|
|
1706
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1707
|
-
keyGenerator: () => string
|
|
1708
|
-
pendingEvents: Array<
|
|
1709
|
-
InternalPatchEvent | MutationEvent
|
|
1710
|
-
>
|
|
1711
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1712
|
-
schema: EditorSchema
|
|
1713
|
-
initialReadOnly: boolean
|
|
1714
|
-
maxBlocks: number | undefined
|
|
1715
|
-
selection: EditorSelection
|
|
1716
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1717
|
-
internalDrag?: {
|
|
1718
|
-
ghost?: HTMLElement
|
|
1719
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1720
|
-
}
|
|
1721
|
-
slateEditor?: PortableTextSlateEditor
|
|
1722
|
-
},
|
|
1723
|
-
{
|
|
1724
|
-
type: 'dragstart'
|
|
1725
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1726
|
-
ghost?: HTMLElement
|
|
1727
|
-
},
|
|
1728
|
-
| InternalPatchEvent
|
|
1729
|
-
| MutationEvent
|
|
1730
|
-
| PatchesEvent
|
|
1731
|
-
| {
|
|
1732
|
-
type: 'update readOnly'
|
|
1733
|
-
readOnly: boolean
|
|
1734
|
-
}
|
|
1735
|
-
| {
|
|
1736
|
-
type: 'update maxBlocks'
|
|
1737
|
-
maxBlocks: number | undefined
|
|
1738
|
-
}
|
|
1739
|
-
| {
|
|
1740
|
-
type: 'add behavior'
|
|
1741
|
-
behaviorConfig: BehaviorConfig
|
|
1742
|
-
}
|
|
1743
|
-
| {
|
|
1744
|
-
type: 'remove behavior'
|
|
1745
|
-
behaviorConfig: BehaviorConfig
|
|
1746
|
-
}
|
|
1747
|
-
| {
|
|
1748
|
-
type: 'blur'
|
|
1749
|
-
editor: PortableTextSlateEditor
|
|
1750
|
-
}
|
|
1751
|
-
| {
|
|
1752
|
-
type: 'focus'
|
|
1753
|
-
editor: PortableTextSlateEditor
|
|
1754
|
-
}
|
|
1755
|
-
| {
|
|
1756
|
-
type: 'normalizing'
|
|
1757
|
-
}
|
|
1758
|
-
| {
|
|
1759
|
-
type: 'update selection'
|
|
1760
|
-
selection: EditorSelection
|
|
1761
|
-
}
|
|
1762
|
-
| {
|
|
1763
|
-
type: 'done normalizing'
|
|
1764
|
-
}
|
|
1765
|
-
| {
|
|
1766
|
-
type: 'done syncing value'
|
|
1767
|
-
}
|
|
1768
|
-
| {
|
|
1769
|
-
type: 'syncing value'
|
|
1770
|
-
}
|
|
1771
|
-
| {
|
|
1772
|
-
type: 'behavior event'
|
|
1773
|
-
behaviorEvent: BehaviorEvent
|
|
1774
|
-
editor: PortableTextSlateEditor
|
|
1775
|
-
nativeEvent?: {
|
|
1776
|
-
preventDefault: () => void
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
| {
|
|
1780
|
-
type: 'dragstart'
|
|
1781
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1782
|
-
ghost?: HTMLElement
|
|
1783
|
-
}
|
|
1784
|
-
| {
|
|
1785
|
-
type: 'dragend'
|
|
1786
|
-
}
|
|
1787
|
-
| {
|
|
1788
|
-
type: 'drop'
|
|
1789
|
-
},
|
|
1790
|
-
undefined,
|
|
1791
|
-
never,
|
|
1792
|
-
never,
|
|
1793
|
-
never,
|
|
1794
|
-
never,
|
|
1795
|
-
never
|
|
1796
|
-
>,
|
|
1797
|
-
]
|
|
1798
|
-
readonly target: 'dragging internally'
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
readonly 'focusing': {
|
|
1803
|
-
readonly initial: 'checking if busy'
|
|
1804
|
-
readonly states: {
|
|
1805
|
-
readonly 'checking if busy': {
|
|
1806
|
-
readonly entry: readonly [() => void]
|
|
1807
|
-
readonly exit: readonly [() => void]
|
|
1808
|
-
readonly always: readonly [
|
|
1809
|
-
{
|
|
1810
|
-
readonly guard: 'slate is busy'
|
|
1811
|
-
readonly target: 'busy'
|
|
1812
|
-
},
|
|
1813
|
-
{
|
|
1814
|
-
readonly target: '#editor.edit mode.editable.idle'
|
|
1815
|
-
readonly actions: readonly ['handle focus']
|
|
1816
|
-
},
|
|
1817
|
-
]
|
|
1818
|
-
}
|
|
1819
|
-
readonly 'busy': {
|
|
1820
|
-
readonly entry: readonly [() => void]
|
|
1821
|
-
readonly exit: readonly [() => void]
|
|
1822
|
-
readonly after: {
|
|
1823
|
-
readonly 10: {
|
|
1824
|
-
readonly target: 'checking if busy'
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
readonly 'dragging internally': {
|
|
1831
|
-
readonly entry: readonly [() => void]
|
|
1832
|
-
readonly exit: readonly [
|
|
1833
|
-
() => void,
|
|
1834
|
-
({
|
|
1835
|
-
context,
|
|
1836
|
-
}: ActionArgs<
|
|
1837
|
-
{
|
|
1838
|
-
behaviors: Set<BehaviorConfig>
|
|
1839
|
-
converters: Set<Converter>
|
|
1840
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1841
|
-
keyGenerator: () => string
|
|
1842
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1843
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1844
|
-
schema: EditorSchema
|
|
1845
|
-
initialReadOnly: boolean
|
|
1846
|
-
maxBlocks: number | undefined
|
|
1847
|
-
selection: EditorSelection
|
|
1848
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1849
|
-
internalDrag?: {
|
|
1850
|
-
ghost?: HTMLElement
|
|
1851
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1852
|
-
}
|
|
1853
|
-
slateEditor?: PortableTextSlateEditor
|
|
1854
|
-
},
|
|
1855
|
-
| InternalPatchEvent
|
|
1856
|
-
| MutationEvent
|
|
1857
|
-
| PatchesEvent
|
|
1858
|
-
| {
|
|
1859
|
-
type: 'update readOnly'
|
|
1860
|
-
readOnly: boolean
|
|
1861
|
-
}
|
|
1862
|
-
| {
|
|
1863
|
-
type: 'update maxBlocks'
|
|
1864
|
-
maxBlocks: number | undefined
|
|
1865
|
-
}
|
|
1866
|
-
| {
|
|
1867
|
-
type: 'add behavior'
|
|
1868
|
-
behaviorConfig: BehaviorConfig
|
|
1869
|
-
}
|
|
1870
|
-
| {
|
|
1871
|
-
type: 'remove behavior'
|
|
1872
|
-
behaviorConfig: BehaviorConfig
|
|
1873
|
-
}
|
|
1874
|
-
| {
|
|
1875
|
-
type: 'blur'
|
|
1876
|
-
editor: PortableTextSlateEditor
|
|
1877
|
-
}
|
|
1878
|
-
| {
|
|
1879
|
-
type: 'focus'
|
|
1880
|
-
editor: PortableTextSlateEditor
|
|
1881
|
-
}
|
|
1882
|
-
| {
|
|
1883
|
-
type: 'normalizing'
|
|
1884
|
-
}
|
|
1885
|
-
| {
|
|
1886
|
-
type: 'update selection'
|
|
1887
|
-
selection: EditorSelection
|
|
1888
|
-
}
|
|
1889
|
-
| {
|
|
1890
|
-
type: 'done normalizing'
|
|
1891
|
-
}
|
|
1892
|
-
| {
|
|
1893
|
-
type: 'done syncing value'
|
|
1894
|
-
}
|
|
1895
|
-
| {
|
|
1896
|
-
type: 'syncing value'
|
|
1897
|
-
}
|
|
1898
|
-
| {
|
|
1899
|
-
type: 'behavior event'
|
|
1900
|
-
behaviorEvent: BehaviorEvent
|
|
1901
|
-
editor: PortableTextSlateEditor
|
|
1902
|
-
nativeEvent?: {
|
|
1903
|
-
preventDefault: () => void
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
| {
|
|
1907
|
-
type: 'dragstart'
|
|
1908
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1909
|
-
ghost?: HTMLElement
|
|
1910
|
-
}
|
|
1911
|
-
| {
|
|
1912
|
-
type: 'dragend'
|
|
1913
|
-
}
|
|
1914
|
-
| {
|
|
1915
|
-
type: 'drop'
|
|
1916
|
-
},
|
|
1917
|
-
| InternalPatchEvent
|
|
1918
|
-
| MutationEvent
|
|
1919
|
-
| PatchesEvent
|
|
1920
|
-
| {
|
|
1921
|
-
type: 'update readOnly'
|
|
1922
|
-
readOnly: boolean
|
|
1923
|
-
}
|
|
1924
|
-
| {
|
|
1925
|
-
type: 'update maxBlocks'
|
|
1926
|
-
maxBlocks: number | undefined
|
|
1927
|
-
}
|
|
1928
|
-
| {
|
|
1929
|
-
type: 'add behavior'
|
|
1930
|
-
behaviorConfig: BehaviorConfig
|
|
1931
|
-
}
|
|
1932
|
-
| {
|
|
1933
|
-
type: 'remove behavior'
|
|
1934
|
-
behaviorConfig: BehaviorConfig
|
|
1935
|
-
}
|
|
1936
|
-
| {
|
|
1937
|
-
type: 'blur'
|
|
1938
|
-
editor: PortableTextSlateEditor
|
|
1939
|
-
}
|
|
1940
|
-
| {
|
|
1941
|
-
type: 'focus'
|
|
1942
|
-
editor: PortableTextSlateEditor
|
|
1943
|
-
}
|
|
1944
|
-
| {
|
|
1945
|
-
type: 'normalizing'
|
|
1946
|
-
}
|
|
1947
|
-
| {
|
|
1948
|
-
type: 'update selection'
|
|
1949
|
-
selection: EditorSelection
|
|
1950
|
-
}
|
|
1951
|
-
| {
|
|
1952
|
-
type: 'done normalizing'
|
|
1953
|
-
}
|
|
1954
|
-
| {
|
|
1955
|
-
type: 'done syncing value'
|
|
1956
|
-
}
|
|
1957
|
-
| {
|
|
1958
|
-
type: 'syncing value'
|
|
1959
|
-
}
|
|
1960
|
-
| {
|
|
1961
|
-
type: 'behavior event'
|
|
1962
|
-
behaviorEvent: BehaviorEvent
|
|
1963
|
-
editor: PortableTextSlateEditor
|
|
1964
|
-
nativeEvent?: {
|
|
1965
|
-
preventDefault: () => void
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
| {
|
|
1969
|
-
type: 'dragstart'
|
|
1970
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1971
|
-
ghost?: HTMLElement
|
|
1972
|
-
}
|
|
1973
|
-
| {
|
|
1974
|
-
type: 'dragend'
|
|
1975
|
-
}
|
|
1976
|
-
| {
|
|
1977
|
-
type: 'drop'
|
|
1978
|
-
}
|
|
1979
|
-
>) => void,
|
|
1980
|
-
ActionFunction<
|
|
1981
|
-
{
|
|
1982
|
-
behaviors: Set<BehaviorConfig>
|
|
1983
|
-
converters: Set<Converter>
|
|
1984
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1985
|
-
keyGenerator: () => string
|
|
1986
|
-
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1987
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1988
|
-
schema: EditorSchema
|
|
1989
|
-
initialReadOnly: boolean
|
|
1990
|
-
maxBlocks: number | undefined
|
|
1991
|
-
selection: EditorSelection
|
|
1992
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
1993
|
-
internalDrag?: {
|
|
1994
|
-
ghost?: HTMLElement
|
|
1995
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1996
|
-
}
|
|
1997
|
-
slateEditor?: PortableTextSlateEditor
|
|
1998
|
-
},
|
|
1999
|
-
| InternalPatchEvent
|
|
2000
|
-
| MutationEvent
|
|
2001
|
-
| PatchesEvent
|
|
2002
|
-
| {
|
|
2003
|
-
type: 'update readOnly'
|
|
2004
|
-
readOnly: boolean
|
|
2005
|
-
}
|
|
2006
|
-
| {
|
|
2007
|
-
type: 'update maxBlocks'
|
|
2008
|
-
maxBlocks: number | undefined
|
|
2009
|
-
}
|
|
2010
|
-
| {
|
|
2011
|
-
type: 'add behavior'
|
|
2012
|
-
behaviorConfig: BehaviorConfig
|
|
2013
|
-
}
|
|
2014
|
-
| {
|
|
2015
|
-
type: 'remove behavior'
|
|
2016
|
-
behaviorConfig: BehaviorConfig
|
|
2017
|
-
}
|
|
2018
|
-
| {
|
|
2019
|
-
type: 'blur'
|
|
2020
|
-
editor: PortableTextSlateEditor
|
|
2021
|
-
}
|
|
2022
|
-
| {
|
|
2023
|
-
type: 'focus'
|
|
2024
|
-
editor: PortableTextSlateEditor
|
|
2025
|
-
}
|
|
2026
|
-
| {
|
|
2027
|
-
type: 'normalizing'
|
|
2028
|
-
}
|
|
2029
|
-
| {
|
|
2030
|
-
type: 'update selection'
|
|
2031
|
-
selection: EditorSelection
|
|
2032
|
-
}
|
|
2033
|
-
| {
|
|
2034
|
-
type: 'done normalizing'
|
|
2035
|
-
}
|
|
2036
|
-
| {
|
|
2037
|
-
type: 'done syncing value'
|
|
2038
|
-
}
|
|
2039
|
-
| {
|
|
2040
|
-
type: 'syncing value'
|
|
2041
|
-
}
|
|
2042
|
-
| {
|
|
2043
|
-
type: 'behavior event'
|
|
2044
|
-
behaviorEvent: BehaviorEvent
|
|
2045
|
-
editor: PortableTextSlateEditor
|
|
2046
|
-
nativeEvent?: {
|
|
2047
|
-
preventDefault: () => void
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
| {
|
|
2051
|
-
type: 'dragstart'
|
|
2052
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2053
|
-
ghost?: HTMLElement
|
|
2054
|
-
}
|
|
2055
|
-
| {
|
|
2056
|
-
type: 'dragend'
|
|
2057
|
-
}
|
|
2058
|
-
| {
|
|
2059
|
-
type: 'drop'
|
|
2060
|
-
},
|
|
2061
|
-
| InternalPatchEvent
|
|
2062
|
-
| MutationEvent
|
|
2063
|
-
| PatchesEvent
|
|
2064
|
-
| {
|
|
2065
|
-
type: 'update readOnly'
|
|
2066
|
-
readOnly: boolean
|
|
2067
|
-
}
|
|
2068
|
-
| {
|
|
2069
|
-
type: 'update maxBlocks'
|
|
2070
|
-
maxBlocks: number | undefined
|
|
2071
|
-
}
|
|
2072
|
-
| {
|
|
2073
|
-
type: 'add behavior'
|
|
2074
|
-
behaviorConfig: BehaviorConfig
|
|
2075
|
-
}
|
|
2076
|
-
| {
|
|
2077
|
-
type: 'remove behavior'
|
|
2078
|
-
behaviorConfig: BehaviorConfig
|
|
2079
|
-
}
|
|
2080
|
-
| {
|
|
2081
|
-
type: 'blur'
|
|
2082
|
-
editor: PortableTextSlateEditor
|
|
2083
|
-
}
|
|
2084
|
-
| {
|
|
2085
|
-
type: 'focus'
|
|
2086
|
-
editor: PortableTextSlateEditor
|
|
2087
|
-
}
|
|
2088
|
-
| {
|
|
2089
|
-
type: 'normalizing'
|
|
2090
|
-
}
|
|
2091
|
-
| {
|
|
2092
|
-
type: 'update selection'
|
|
2093
|
-
selection: EditorSelection
|
|
2094
|
-
}
|
|
2095
|
-
| {
|
|
2096
|
-
type: 'done normalizing'
|
|
2097
|
-
}
|
|
2098
|
-
| {
|
|
2099
|
-
type: 'done syncing value'
|
|
2100
|
-
}
|
|
2101
|
-
| {
|
|
2102
|
-
type: 'syncing value'
|
|
2103
|
-
}
|
|
2104
|
-
| {
|
|
2105
|
-
type: 'behavior event'
|
|
2106
|
-
behaviorEvent: BehaviorEvent
|
|
2107
|
-
editor: PortableTextSlateEditor
|
|
2108
|
-
nativeEvent?: {
|
|
2109
|
-
preventDefault: () => void
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
| {
|
|
2113
|
-
type: 'dragstart'
|
|
2114
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2115
|
-
ghost?: HTMLElement
|
|
2116
|
-
}
|
|
2117
|
-
| {
|
|
2118
|
-
type: 'dragend'
|
|
2119
|
-
}
|
|
2120
|
-
| {
|
|
2121
|
-
type: 'drop'
|
|
2122
|
-
},
|
|
2123
|
-
undefined,
|
|
2124
|
-
never,
|
|
2125
|
-
never,
|
|
2126
|
-
never,
|
|
2127
|
-
never,
|
|
2128
|
-
never
|
|
2129
|
-
>,
|
|
2130
|
-
]
|
|
2131
|
-
readonly tags: readonly ['dragging internally']
|
|
2132
|
-
readonly on: {
|
|
2133
|
-
readonly dragend: {
|
|
2134
|
-
readonly target: 'idle'
|
|
2135
|
-
}
|
|
2136
|
-
readonly drop: {
|
|
2137
|
-
readonly target: 'idle'
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
readonly 'setup': {
|
|
2146
|
-
readonly initial: 'setting up'
|
|
2147
|
-
readonly states: {
|
|
2148
|
-
readonly 'setting up': {
|
|
2149
|
-
readonly entry: readonly [() => void]
|
|
2150
|
-
readonly exit: readonly [
|
|
2151
|
-
() => void,
|
|
2152
|
-
'emit ready',
|
|
2153
|
-
'emit pending incoming patches',
|
|
2154
|
-
'clear pending incoming patches',
|
|
2155
|
-
]
|
|
2156
|
-
readonly on: {
|
|
2157
|
-
readonly 'internal.patch': {
|
|
2158
|
-
readonly actions: 'defer event'
|
|
2159
|
-
}
|
|
2160
|
-
readonly 'mutation': {
|
|
2161
|
-
readonly actions: 'defer event'
|
|
2162
|
-
}
|
|
2163
|
-
readonly 'done syncing value': {
|
|
2164
|
-
readonly target: 'set up'
|
|
2165
|
-
}
|
|
2166
|
-
readonly 'patches': {
|
|
2167
|
-
readonly actions: readonly ['defer incoming patches']
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
readonly 'set up': {
|
|
2172
|
-
readonly type: 'parallel'
|
|
2173
|
-
readonly states: {
|
|
2174
|
-
readonly 'value sync': {
|
|
2175
|
-
readonly initial: 'idle'
|
|
2176
|
-
readonly states: {
|
|
2177
|
-
readonly 'idle': {
|
|
2178
|
-
readonly entry: readonly [() => void]
|
|
2179
|
-
readonly exit: readonly [() => void]
|
|
2180
|
-
readonly on: {
|
|
2181
|
-
readonly 'patches': {
|
|
2182
|
-
readonly actions: readonly [
|
|
2183
|
-
ActionFunction<
|
|
2184
|
-
{
|
|
2185
|
-
behaviors: Set<BehaviorConfig>
|
|
2186
|
-
converters: Set<Converter>
|
|
2187
|
-
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
2188
|
-
keyGenerator: () => string
|
|
2189
|
-
pendingEvents: Array<
|
|
2190
|
-
InternalPatchEvent | MutationEvent
|
|
2191
|
-
>
|
|
2192
|
-
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
2193
|
-
schema: EditorSchema
|
|
2194
|
-
initialReadOnly: boolean
|
|
2195
|
-
maxBlocks: number | undefined
|
|
2196
|
-
selection: EditorSelection
|
|
2197
|
-
initialValue: Array<PortableTextBlock> | undefined
|
|
2198
|
-
internalDrag?: {
|
|
2199
|
-
ghost?: HTMLElement
|
|
2200
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2201
|
-
}
|
|
2202
|
-
slateEditor?: PortableTextSlateEditor
|
|
2203
|
-
},
|
|
2204
|
-
PatchesEvent,
|
|
2205
|
-
| InternalPatchEvent
|
|
2206
|
-
| MutationEvent
|
|
2207
|
-
| PatchesEvent
|
|
2208
|
-
| {
|
|
2209
|
-
type: 'update readOnly'
|
|
2210
|
-
readOnly: boolean
|
|
2211
|
-
}
|
|
2212
|
-
| {
|
|
2213
|
-
type: 'update maxBlocks'
|
|
2214
|
-
maxBlocks: number | undefined
|
|
2215
|
-
}
|
|
2216
|
-
| {
|
|
2217
|
-
type: 'add behavior'
|
|
2218
|
-
behaviorConfig: BehaviorConfig
|
|
2219
|
-
}
|
|
2220
|
-
| {
|
|
2221
|
-
type: 'remove behavior'
|
|
2222
|
-
behaviorConfig: BehaviorConfig
|
|
2223
|
-
}
|
|
2224
|
-
| {
|
|
2225
|
-
type: 'blur'
|
|
2226
|
-
editor: PortableTextSlateEditor
|
|
2227
|
-
}
|
|
2228
|
-
| {
|
|
2229
|
-
type: 'focus'
|
|
2230
|
-
editor: PortableTextSlateEditor
|
|
2231
|
-
}
|
|
2232
|
-
| {
|
|
2233
|
-
type: 'normalizing'
|
|
2234
|
-
}
|
|
2235
|
-
| {
|
|
2236
|
-
type: 'update selection'
|
|
2237
|
-
selection: EditorSelection
|
|
2238
|
-
}
|
|
2239
|
-
| {
|
|
2240
|
-
type: 'done normalizing'
|
|
2241
|
-
}
|
|
2242
|
-
| {
|
|
2243
|
-
type: 'done syncing value'
|
|
2244
|
-
}
|
|
2245
|
-
| {
|
|
2246
|
-
type: 'syncing value'
|
|
2247
|
-
}
|
|
2248
|
-
| {
|
|
2249
|
-
type: 'behavior event'
|
|
2250
|
-
behaviorEvent: BehaviorEvent
|
|
2251
|
-
editor: PortableTextSlateEditor
|
|
2252
|
-
nativeEvent?: {
|
|
2253
|
-
preventDefault: () => void
|
|
2254
|
-
}
|
|
2255
|
-
}
|
|
2256
|
-
| {
|
|
2257
|
-
type: 'dragstart'
|
|
2258
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2259
|
-
ghost?: HTMLElement
|
|
2260
|
-
}
|
|
2261
|
-
| {
|
|
2262
|
-
type: 'dragend'
|
|
2263
|
-
}
|
|
2264
|
-
| {
|
|
2265
|
-
type: 'drop'
|
|
2266
|
-
},
|
|
2267
|
-
undefined,
|
|
2268
|
-
never,
|
|
2269
|
-
never,
|
|
2270
|
-
never,
|
|
2271
|
-
never,
|
|
2272
|
-
| InternalPatchEvent
|
|
2273
|
-
| MutationEvent
|
|
2274
|
-
| PatchesEvent
|
|
2275
|
-
| {
|
|
2276
|
-
type: 'blurred'
|
|
2277
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
2278
|
-
}
|
|
2279
|
-
| {
|
|
2280
|
-
type: 'done loading'
|
|
2281
|
-
}
|
|
2282
|
-
| {
|
|
2283
|
-
type: 'editable'
|
|
2284
|
-
}
|
|
2285
|
-
| {
|
|
2286
|
-
type: 'error'
|
|
2287
|
-
name: string
|
|
2288
|
-
description: string
|
|
2289
|
-
data: unknown
|
|
2290
|
-
}
|
|
2291
|
-
| {
|
|
2292
|
-
type: 'focused'
|
|
2293
|
-
event: FocusEvent_2<HTMLDivElement, Element>
|
|
2294
|
-
}
|
|
2295
|
-
| {
|
|
2296
|
-
type: 'invalid value'
|
|
2297
|
-
resolution: InvalidValueResolution | null
|
|
2298
|
-
value: Array<PortableTextBlock> | undefined
|
|
2299
|
-
}
|
|
2300
|
-
| {
|
|
2301
|
-
type: 'loading'
|
|
2302
|
-
}
|
|
2303
|
-
| {
|
|
2304
|
-
type: 'read only'
|
|
2305
|
-
}
|
|
2306
|
-
| {
|
|
2307
|
-
type: 'ready'
|
|
2308
|
-
}
|
|
2309
|
-
| {
|
|
2310
|
-
type: 'selection'
|
|
2311
|
-
selection: EditorSelection
|
|
2312
|
-
}
|
|
2313
|
-
| {
|
|
2314
|
-
type: 'value changed'
|
|
2315
|
-
value: Array<PortableTextBlock> | undefined
|
|
2316
|
-
}
|
|
2317
|
-
>,
|
|
2318
|
-
]
|
|
2319
|
-
}
|
|
2320
|
-
readonly 'syncing value': {
|
|
2321
|
-
readonly target: 'syncing value'
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
readonly 'syncing value': {
|
|
2326
|
-
readonly entry: readonly [() => void]
|
|
2327
|
-
readonly exit: readonly [
|
|
2328
|
-
() => void,
|
|
2329
|
-
'emit pending incoming patches',
|
|
2330
|
-
'clear pending incoming patches',
|
|
2331
|
-
]
|
|
2332
|
-
readonly on: {
|
|
2333
|
-
readonly 'patches': {
|
|
2334
|
-
readonly actions: readonly ['defer incoming patches']
|
|
2335
|
-
}
|
|
2336
|
-
readonly 'done syncing value': {
|
|
2337
|
-
readonly target: 'idle'
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
readonly 'writing': {
|
|
2344
|
-
readonly initial: 'pristine'
|
|
2345
|
-
readonly states: {
|
|
2346
|
-
readonly pristine: {
|
|
2347
|
-
readonly initial: 'idle'
|
|
2348
|
-
readonly states: {
|
|
2349
|
-
readonly idle: {
|
|
2350
|
-
readonly entry: readonly [() => void]
|
|
2351
|
-
readonly exit: readonly [() => void]
|
|
2352
|
-
readonly on: {
|
|
2353
|
-
readonly 'normalizing': {
|
|
2354
|
-
readonly target: 'normalizing'
|
|
2355
|
-
}
|
|
2356
|
-
readonly 'internal.patch': {
|
|
2357
|
-
readonly actions: 'defer event'
|
|
2358
|
-
readonly target: '#editor.setup.set up.writing.dirty'
|
|
2359
|
-
}
|
|
2360
|
-
readonly 'mutation': {
|
|
2361
|
-
readonly actions: 'defer event'
|
|
2362
|
-
readonly target: '#editor.setup.set up.writing.dirty'
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
readonly normalizing: {
|
|
2367
|
-
readonly entry: readonly [() => void]
|
|
2368
|
-
readonly exit: readonly [() => void]
|
|
2369
|
-
readonly on: {
|
|
2370
|
-
readonly 'done normalizing': {
|
|
2371
|
-
readonly target: 'idle'
|
|
2372
|
-
}
|
|
2373
|
-
readonly 'internal.patch': {
|
|
2374
|
-
readonly actions: 'defer event'
|
|
2375
|
-
}
|
|
2376
|
-
readonly 'mutation': {
|
|
2377
|
-
readonly actions: 'defer event'
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
}
|
|
2383
|
-
readonly dirty: {
|
|
2384
|
-
readonly entry: readonly [
|
|
2385
|
-
() => void,
|
|
2386
|
-
'emit pending events',
|
|
2387
|
-
'clear pending events',
|
|
2388
|
-
]
|
|
2389
|
-
readonly exit: readonly [() => void]
|
|
2390
|
-
readonly on: {
|
|
2391
|
-
readonly 'internal.patch': {
|
|
2392
|
-
readonly actions: 'emit patch event'
|
|
2393
|
-
}
|
|
2394
|
-
readonly 'mutation': {
|
|
2395
|
-
readonly actions: 'emit mutation event'
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
>
|
|
2408
|
-
|
|
2409
|
-
declare type EditorPriority = {
|
|
2410
|
-
id: string
|
|
2411
|
-
name?: string
|
|
2412
|
-
reference?: {
|
|
2413
|
-
priority: EditorPriority
|
|
2414
|
-
importance: 'higher' | 'lower'
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
157
|
/**
|
|
2419
158
|
* @public
|
|
2420
159
|
*/
|
|
@@ -2503,27 +242,9 @@ declare type EditorSnapshot = {
|
|
|
2503
242
|
beta: {
|
|
2504
243
|
activeAnnotations: Array<string>
|
|
2505
244
|
activeDecorators: Array<string>
|
|
2506
|
-
hasTag: HasTag
|
|
2507
|
-
internalDrag:
|
|
2508
|
-
| {
|
|
2509
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2510
|
-
}
|
|
2511
|
-
| undefined
|
|
2512
245
|
}
|
|
2513
246
|
}
|
|
2514
247
|
|
|
2515
|
-
declare type EventPosition = {
|
|
2516
|
-
block: 'start' | 'end'
|
|
2517
|
-
/**
|
|
2518
|
-
* Did the event origin from the editor DOM node itself or from a child node?
|
|
2519
|
-
*/
|
|
2520
|
-
isEditor: boolean
|
|
2521
|
-
selection: NonNullable<EditorSelection>
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
declare type ExtractNamespace<TType extends string> =
|
|
2525
|
-
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
2526
|
-
|
|
2527
248
|
/**
|
|
2528
249
|
* @public
|
|
2529
250
|
*/
|
|
@@ -2579,43 +300,6 @@ export declare function getSelectionStartPoint<
|
|
|
2579
300
|
*/
|
|
2580
301
|
export declare function getTextBlockText(block: PortableTextTextBlock): string
|
|
2581
302
|
|
|
2582
|
-
declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
|
|
2583
|
-
|
|
2584
|
-
declare interface History_2 {
|
|
2585
|
-
redos: HistoryItem[]
|
|
2586
|
-
undos: HistoryItem[]
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2589
|
-
declare type HistoryItem = {
|
|
2590
|
-
operations: Operation[]
|
|
2591
|
-
timestamp: Date
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
/**
|
|
2595
|
-
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
2596
|
-
*
|
|
2597
|
-
* These can either be one of:
|
|
2598
|
-
*
|
|
2599
|
-
* - insertFromPaste
|
|
2600
|
-
* - insertFromPasteAsQuotation
|
|
2601
|
-
* - insertFromDrop
|
|
2602
|
-
* - insertReplacementText
|
|
2603
|
-
* - insertFromYank
|
|
2604
|
-
*/
|
|
2605
|
-
declare type InputBehaviorEvent = {
|
|
2606
|
-
type: StrictExtract<NativeBehaviorEventType, 'input.*'>
|
|
2607
|
-
originEvent: {
|
|
2608
|
-
dataTransfer: DataTransfer
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
2613
|
-
|
|
2614
|
-
declare type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
|
|
2615
|
-
operationId?: string
|
|
2616
|
-
value: Array<PortableTextBlock>
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
303
|
/**
|
|
2620
304
|
* @public
|
|
2621
305
|
*/
|
|
@@ -2670,27 +354,6 @@ export declare function isTextBlock(
|
|
|
2670
354
|
block: unknown,
|
|
2671
355
|
): block is PortableTextTextBlock
|
|
2672
356
|
|
|
2673
|
-
declare type KeyboardBehaviorEvent =
|
|
2674
|
-
| {
|
|
2675
|
-
type: StrictExtract<NativeBehaviorEventType, 'keyboard.keydown'>
|
|
2676
|
-
originEvent: Pick<
|
|
2677
|
-
KeyboardEvent,
|
|
2678
|
-
'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
|
|
2679
|
-
>
|
|
2680
|
-
}
|
|
2681
|
-
| {
|
|
2682
|
-
type: StrictExtract<NativeBehaviorEventType, 'keyboard.keyup'>
|
|
2683
|
-
originEvent: Pick<
|
|
2684
|
-
KeyboardEvent,
|
|
2685
|
-
'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
|
|
2686
|
-
>
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
declare type MarkState = {
|
|
2690
|
-
state: 'changed' | 'unchanged'
|
|
2691
|
-
marks: Array<string>
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
357
|
/**
|
|
2695
358
|
* @beta
|
|
2696
359
|
*/
|
|
@@ -2706,96 +369,6 @@ export declare function mergeTextBlocks({
|
|
|
2706
369
|
|
|
2707
370
|
declare type MIMEType = `${string}/${string}`
|
|
2708
371
|
|
|
2709
|
-
declare type MouseBehaviorEvent = {
|
|
2710
|
-
type: StrictExtract<NativeBehaviorEventType, 'mouse.click'>
|
|
2711
|
-
position: EventPosition
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
/**
|
|
2715
|
-
* @public
|
|
2716
|
-
*/
|
|
2717
|
-
declare type MutationEvent = {
|
|
2718
|
-
type: 'mutation'
|
|
2719
|
-
patches: Array<Patch>
|
|
2720
|
-
/**
|
|
2721
|
-
* @deprecated Use `value` instead
|
|
2722
|
-
*/
|
|
2723
|
-
snapshot: Array<PortableTextBlock> | undefined
|
|
2724
|
-
value: Array<PortableTextBlock> | undefined
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
declare type NamespacedBehaviorEventType<
|
|
2728
|
-
TNamespace extends BehaviorEventTypeNamespace | '',
|
|
2729
|
-
> = TNamespace extends ''
|
|
2730
|
-
? BehaviorEvent['type']
|
|
2731
|
-
: Extract<BehaviorEvent['type'], TNamespace | `${TNamespace}.${string}`>
|
|
2732
|
-
|
|
2733
|
-
declare type NamespaceEvent<
|
|
2734
|
-
TEvent,
|
|
2735
|
-
TNamespace extends string,
|
|
2736
|
-
> = TEvent extends {
|
|
2737
|
-
type: infer TEventType
|
|
2738
|
-
}
|
|
2739
|
-
? {
|
|
2740
|
-
[K in keyof TEvent]: K extends 'type'
|
|
2741
|
-
? `${TNamespace}.${TEventType & string}`
|
|
2742
|
-
: TEvent[K]
|
|
2743
|
-
}
|
|
2744
|
-
: never
|
|
2745
|
-
|
|
2746
|
-
/**
|
|
2747
|
-
* @beta
|
|
2748
|
-
*/
|
|
2749
|
-
declare type NativeBehaviorEvent =
|
|
2750
|
-
| ClipboardBehaviorEvent
|
|
2751
|
-
| DragBehaviorEvent
|
|
2752
|
-
| InputBehaviorEvent
|
|
2753
|
-
| KeyboardBehaviorEvent
|
|
2754
|
-
| MouseBehaviorEvent
|
|
2755
|
-
|
|
2756
|
-
declare type NativeBehaviorEventNamespace =
|
|
2757
|
-
ExtractNamespace<NativeBehaviorEventType>
|
|
2758
|
-
|
|
2759
|
-
declare type NativeBehaviorEventType = (typeof nativeBehaviorEventTypes)[number]
|
|
2760
|
-
|
|
2761
|
-
/**************************************
|
|
2762
|
-
* Native events
|
|
2763
|
-
**************************************/
|
|
2764
|
-
declare const nativeBehaviorEventTypes: readonly [
|
|
2765
|
-
'clipboard.copy',
|
|
2766
|
-
'clipboard.cut',
|
|
2767
|
-
'clipboard.paste',
|
|
2768
|
-
'drag.dragstart',
|
|
2769
|
-
'drag.drag',
|
|
2770
|
-
'drag.dragend',
|
|
2771
|
-
'drag.dragenter',
|
|
2772
|
-
'drag.dragover',
|
|
2773
|
-
'drag.dragleave',
|
|
2774
|
-
'drag.drop',
|
|
2775
|
-
'input.*',
|
|
2776
|
-
'keyboard.keydown',
|
|
2777
|
-
'keyboard.keyup',
|
|
2778
|
-
'mouse.click',
|
|
2779
|
-
]
|
|
2780
|
-
|
|
2781
|
-
declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
2782
|
-
_key?: PortableTextObject['_key']
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
/**
|
|
2786
|
-
* @public
|
|
2787
|
-
*/
|
|
2788
|
-
declare type PatchesEvent = {
|
|
2789
|
-
type: 'patches'
|
|
2790
|
-
patches: Array<Patch>
|
|
2791
|
-
snapshot: Array<PortableTextBlock> | undefined
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
declare type PatchEvent = {
|
|
2795
|
-
type: 'patch'
|
|
2796
|
-
patch: Patch
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
372
|
/**
|
|
2800
373
|
* @internal
|
|
2801
374
|
*/
|
|
@@ -2805,82 +378,6 @@ declare type PickFromUnion<
|
|
|
2805
378
|
TPickedTags extends TUnion[TTagKey],
|
|
2806
379
|
> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never
|
|
2807
380
|
|
|
2808
|
-
/** @beta */
|
|
2809
|
-
declare type PortableTextMemberSchemaTypes = {
|
|
2810
|
-
annotations: (ObjectSchemaType & {
|
|
2811
|
-
i18nTitleKey?: string
|
|
2812
|
-
})[]
|
|
2813
|
-
block: ObjectSchemaType
|
|
2814
|
-
blockObjects: ObjectSchemaType[]
|
|
2815
|
-
decorators: BlockDecoratorDefinition[]
|
|
2816
|
-
inlineObjects: ObjectSchemaType[]
|
|
2817
|
-
portableText: ArraySchemaType<PortableTextBlock>
|
|
2818
|
-
span: ObjectSchemaType
|
|
2819
|
-
styles: BlockStyleDefinition[]
|
|
2820
|
-
lists: BlockListDefinition[]
|
|
2821
|
-
}
|
|
2822
|
-
|
|
2823
|
-
declare interface PortableTextSlateEditor extends ReactEditor {
|
|
2824
|
-
_key: 'editor'
|
|
2825
|
-
_type: 'editor'
|
|
2826
|
-
createPlaceholderBlock: () => Descendant
|
|
2827
|
-
editable: EditableAPI
|
|
2828
|
-
history: History_2
|
|
2829
|
-
insertPortableTextData: (data: DataTransfer) => boolean
|
|
2830
|
-
insertTextOrHTMLData: (data: DataTransfer) => boolean
|
|
2831
|
-
isTextBlock: (value: unknown) => value is PortableTextTextBlock
|
|
2832
|
-
isTextSpan: (value: unknown) => value is PortableTextSpan
|
|
2833
|
-
isListBlock: (value: unknown) => value is PortableTextListBlock
|
|
2834
|
-
value: Array<PortableTextBlock>
|
|
2835
|
-
decoratorState: Record<string, boolean | undefined>
|
|
2836
|
-
markState: MarkState | undefined
|
|
2837
|
-
/**
|
|
2838
|
-
* Use hotkeys
|
|
2839
|
-
*/
|
|
2840
|
-
pteWithHotKeys: (event: KeyboardEvent_2<HTMLDivElement>) => void
|
|
2841
|
-
/**
|
|
2842
|
-
* Helper function that creates a text block
|
|
2843
|
-
*/
|
|
2844
|
-
pteCreateTextBlock: (options: {
|
|
2845
|
-
decorators: Array<string>
|
|
2846
|
-
listItem?: string
|
|
2847
|
-
level?: number
|
|
2848
|
-
}) => Descendant
|
|
2849
|
-
/**
|
|
2850
|
-
* Undo
|
|
2851
|
-
*/
|
|
2852
|
-
undo: () => void
|
|
2853
|
-
/**
|
|
2854
|
-
* Redo
|
|
2855
|
-
*/
|
|
2856
|
-
redo: () => void
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
|
-
/**************************************
|
|
2860
|
-
* Resolve behavior event
|
|
2861
|
-
**************************************/
|
|
2862
|
-
declare type ResolveBehaviorEvent<
|
|
2863
|
-
TBehaviorEventType extends
|
|
2864
|
-
| '*'
|
|
2865
|
-
| `${BehaviorEventTypeNamespace}.*`
|
|
2866
|
-
| BehaviorEvent['type'],
|
|
2867
|
-
TPayload extends Record<string, unknown> = Record<string, unknown>,
|
|
2868
|
-
> = TBehaviorEventType extends '*'
|
|
2869
|
-
? BehaviorEvent
|
|
2870
|
-
: TBehaviorEventType extends `${infer TNamespace}.*`
|
|
2871
|
-
? TNamespace extends BehaviorEventTypeNamespace
|
|
2872
|
-
? PickFromUnion<
|
|
2873
|
-
BehaviorEvent,
|
|
2874
|
-
'type',
|
|
2875
|
-
NamespacedBehaviorEventType<TNamespace>
|
|
2876
|
-
>
|
|
2877
|
-
: never
|
|
2878
|
-
: TBehaviorEventType extends `custom.${infer TType}`
|
|
2879
|
-
? CustomBehaviorEvent<TPayload, TType>
|
|
2880
|
-
: TBehaviorEventType extends BehaviorEvent['type']
|
|
2881
|
-
? PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>
|
|
2882
|
-
: never
|
|
2883
|
-
|
|
2884
381
|
/**
|
|
2885
382
|
* @public
|
|
2886
383
|
*/
|
|
@@ -2951,148 +448,4 @@ export declare function splitTextBlock({
|
|
|
2951
448
|
}
|
|
2952
449
|
| undefined
|
|
2953
450
|
|
|
2954
|
-
declare type StrictExtract<T, U extends T> = U
|
|
2955
|
-
|
|
2956
|
-
/**
|
|
2957
|
-
* @beta
|
|
2958
|
-
*/
|
|
2959
|
-
declare type SyntheticBehaviorEvent =
|
|
2960
|
-
| {
|
|
2961
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'annotation.add'>
|
|
2962
|
-
annotation: {
|
|
2963
|
-
name: string
|
|
2964
|
-
value: {
|
|
2965
|
-
[prop: string]: unknown
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
| {
|
|
2970
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'annotation.remove'>
|
|
2971
|
-
annotation: {
|
|
2972
|
-
name: string
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
| {
|
|
2976
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'block.set'>
|
|
2977
|
-
at: [KeyedSegment]
|
|
2978
|
-
props: Record<string, unknown>
|
|
2979
|
-
}
|
|
2980
|
-
| {
|
|
2981
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'block.unset'>
|
|
2982
|
-
at: [KeyedSegment]
|
|
2983
|
-
props: Array<string>
|
|
2984
|
-
}
|
|
2985
|
-
| {
|
|
2986
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.add'>
|
|
2987
|
-
decorator: string
|
|
2988
|
-
at?: {
|
|
2989
|
-
anchor: BlockOffset
|
|
2990
|
-
focus: BlockOffset
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
| {
|
|
2994
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'decorator.remove'>
|
|
2995
|
-
decorator: string
|
|
2996
|
-
}
|
|
2997
|
-
| {
|
|
2998
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'delete'>
|
|
2999
|
-
at: NonNullable<EditorSelection>
|
|
3000
|
-
/**
|
|
3001
|
-
* Defaults to forward deletion.
|
|
3002
|
-
*/
|
|
3003
|
-
direction?: 'backward' | 'forward'
|
|
3004
|
-
/**
|
|
3005
|
-
* Defaults to character deletion.
|
|
3006
|
-
*/
|
|
3007
|
-
unit?: 'character' | 'word' | 'line' | 'block'
|
|
3008
|
-
}
|
|
3009
|
-
| {
|
|
3010
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'history.redo'>
|
|
3011
|
-
}
|
|
3012
|
-
| {
|
|
3013
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'history.undo'>
|
|
3014
|
-
}
|
|
3015
|
-
| {
|
|
3016
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.inline object'>
|
|
3017
|
-
inlineObject: {
|
|
3018
|
-
name: string
|
|
3019
|
-
value?: {
|
|
3020
|
-
[prop: string]: unknown
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
| {
|
|
3025
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.block'>
|
|
3026
|
-
block: BlockWithOptionalKey
|
|
3027
|
-
placement: InsertPlacement
|
|
3028
|
-
select?: 'start' | 'end' | 'none'
|
|
3029
|
-
}
|
|
3030
|
-
| {
|
|
3031
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.span'>
|
|
3032
|
-
text: string
|
|
3033
|
-
annotations?: Array<{
|
|
3034
|
-
name: string
|
|
3035
|
-
value: {
|
|
3036
|
-
[prop: string]: unknown
|
|
3037
|
-
}
|
|
3038
|
-
}>
|
|
3039
|
-
decorators?: Array<string>
|
|
3040
|
-
}
|
|
3041
|
-
| {
|
|
3042
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'insert.text'>
|
|
3043
|
-
text: string
|
|
3044
|
-
}
|
|
3045
|
-
| {
|
|
3046
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'move.backward'>
|
|
3047
|
-
distance: number
|
|
3048
|
-
}
|
|
3049
|
-
| {
|
|
3050
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'move.block'>
|
|
3051
|
-
at: [KeyedSegment]
|
|
3052
|
-
to: [KeyedSegment]
|
|
3053
|
-
}
|
|
3054
|
-
| {
|
|
3055
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'move.forward'>
|
|
3056
|
-
distance: number
|
|
3057
|
-
}
|
|
3058
|
-
| {
|
|
3059
|
-
type: StrictExtract<SyntheticBehaviorEventType, 'select'>
|
|
3060
|
-
at: EditorSelection
|
|
3061
|
-
}
|
|
3062
|
-
| AbstractBehaviorEvent
|
|
3063
|
-
|
|
3064
|
-
declare type SyntheticBehaviorEventNamespace =
|
|
3065
|
-
ExtractNamespace<SyntheticBehaviorEventType>
|
|
3066
|
-
|
|
3067
|
-
declare type SyntheticBehaviorEventType =
|
|
3068
|
-
| (typeof syntheticBehaviorEventTypes)[number]
|
|
3069
|
-
| (typeof abstractBehaviorEventTypes)[number]
|
|
3070
|
-
|
|
3071
|
-
/**************************************
|
|
3072
|
-
* Synthetic events
|
|
3073
|
-
**************************************/
|
|
3074
|
-
declare const syntheticBehaviorEventTypes: readonly [
|
|
3075
|
-
'annotation.add',
|
|
3076
|
-
'annotation.remove',
|
|
3077
|
-
'block.set',
|
|
3078
|
-
'block.unset',
|
|
3079
|
-
'decorator.add',
|
|
3080
|
-
'decorator.remove',
|
|
3081
|
-
'delete',
|
|
3082
|
-
'history.redo',
|
|
3083
|
-
'history.undo',
|
|
3084
|
-
'insert.inline object',
|
|
3085
|
-
'insert.block',
|
|
3086
|
-
'insert.span',
|
|
3087
|
-
'insert.text',
|
|
3088
|
-
'move.backward',
|
|
3089
|
-
'move.block',
|
|
3090
|
-
'move.forward',
|
|
3091
|
-
'select',
|
|
3092
|
-
]
|
|
3093
|
-
|
|
3094
|
-
declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
|
|
3095
|
-
_key?: PortableTextTextBlock['_key']
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
451
|
export {}
|