@portabletext/editor 1.41.0 → 1.41.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "1.41.0",
3
+ "version": "1.41.2",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -79,8 +79,8 @@
79
79
  "slate-react": "0.112.1",
80
80
  "use-effect-event": "^1.0.2",
81
81
  "xstate": "^5.19.2",
82
- "@portabletext/patches": "1.1.3",
83
- "@portabletext/block-tools": "1.1.14"
82
+ "@portabletext/block-tools": "1.1.14",
83
+ "@portabletext/patches": "1.1.3"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@portabletext/toolkit": "^2.0.17",
@@ -9,33 +9,38 @@ import type {BlockOffset} from '../types/block-offset'
9
9
  import type {BlockWithOptionalKey} from '../types/block-with-optional-key'
10
10
  import type {EditorSelection, PortableTextSlateEditor} from '../types/editor'
11
11
 
12
- export type BehaviorEventTypeNamespace =
13
- | 'annotation'
14
- | 'block'
15
- | 'blur'
16
- | 'clipboard'
17
- | 'custom'
18
- | 'data transfer'
19
- | 'decorator'
20
- | 'delete'
21
- | 'deserialization'
22
- | 'deserialize'
23
- | 'drag'
24
- | 'focus'
25
- | 'history'
26
- | 'input'
27
- | 'insert'
28
- | 'keyboard'
29
- | 'list item'
30
- | 'mouse'
31
- | 'move'
32
- | 'select'
33
- | 'serialization'
34
- | 'serialize'
35
- | 'style'
12
+ /**
13
+ * @beta
14
+ */
15
+ export type BehaviorEvent =
16
+ | SyntheticBehaviorEvent
17
+ | InternalBehaviorEvent
18
+ | NativeBehaviorEvent
19
+ | CustomBehaviorEvent
20
+
21
+ type BehaviorEventTypeNamespace =
22
+ | SyntheticBehaviorEventNamespace
23
+ | InternalBehaviorEventNamespace
24
+ | NativeBehaviorEventNamespace
25
+ | CustomBehaviorEventNamespace
26
+
27
+ type SyntheticBehaviorEventType<
28
+ TNamespace extends SyntheticBehaviorEventNamespace,
29
+ TType extends string = '',
30
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
31
+
32
+ type InternalBehaviorEventType<
33
+ TNamespace extends InternalBehaviorEventNamespace,
34
+ TType extends string = '',
35
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
36
36
 
37
- export type BehaviorEventType<
38
- TNamespace extends BehaviorEventTypeNamespace,
37
+ type NativeBehaviorEventType<
38
+ TNamespace extends NativeBehaviorEventNamespace,
39
+ TType extends string = '',
40
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
41
+
42
+ type CustomBehaviorEventType<
43
+ TNamespace extends CustomBehaviorEventNamespace,
39
44
  TType extends string = '',
40
45
  > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
41
46
 
@@ -48,8 +53,8 @@ export type NamespacedBehaviorEventType<
48
53
  /**
49
54
  * @beta
50
55
  */
51
- export type ExternalBehaviorEvent = {
52
- type: BehaviorEventType<'insert', 'block object'>
56
+ export type ExternalSyntheticBehaviorEvent = {
57
+ type: SyntheticBehaviorEventType<'insert', 'block object'>
53
58
  placement: InsertPlacement
54
59
  blockObject: {
55
60
  name: string
@@ -57,119 +62,140 @@ export type ExternalBehaviorEvent = {
57
62
  }
58
63
  }
59
64
 
65
+ /**************************************
66
+ * Synthetic events
67
+ **************************************/
68
+
69
+ type SyntheticBehaviorEventNamespace =
70
+ | 'annotation'
71
+ | 'block'
72
+ | 'blur'
73
+ | 'data transfer'
74
+ | 'decorator'
75
+ | 'delete'
76
+ | 'deserialization'
77
+ | 'focus'
78
+ | 'history'
79
+ | 'insert'
80
+ | 'list item'
81
+ | 'move'
82
+ | 'select'
83
+ | 'serialization'
84
+ | 'style'
85
+
60
86
  /**
61
87
  * @beta
62
88
  */
63
89
  export type SyntheticBehaviorEvent =
64
90
  | {
65
- type: BehaviorEventType<'annotation', 'add'>
91
+ type: SyntheticBehaviorEventType<'annotation', 'add'>
66
92
  annotation: {
67
93
  name: string
68
94
  value: {[prop: string]: unknown}
69
95
  }
70
96
  }
71
97
  | {
72
- type: BehaviorEventType<'annotation', 'remove'>
98
+ type: SyntheticBehaviorEventType<'annotation', 'remove'>
73
99
  annotation: {
74
100
  name: string
75
101
  }
76
102
  }
77
103
  | {
78
- type: BehaviorEventType<'annotation', 'toggle'>
104
+ type: SyntheticBehaviorEventType<'annotation', 'toggle'>
79
105
  annotation: {
80
106
  name: string
81
107
  value: {[prop: string]: unknown}
82
108
  }
83
109
  }
84
110
  | {
85
- type: BehaviorEventType<'block', 'set'>
111
+ type: SyntheticBehaviorEventType<'block', 'set'>
86
112
  at: [KeyedSegment]
87
113
  props: Record<string, unknown>
88
114
  }
89
115
  | {
90
- type: BehaviorEventType<'block', 'unset'>
116
+ type: SyntheticBehaviorEventType<'block', 'unset'>
91
117
  at: [KeyedSegment]
92
118
  props: Array<string>
93
119
  }
94
120
  | {
95
- type: BehaviorEventType<'blur'>
121
+ type: SyntheticBehaviorEventType<'blur'>
96
122
  }
97
123
  | {
98
- type: BehaviorEventType<'data transfer', 'set'>
124
+ type: SyntheticBehaviorEventType<'data transfer', 'set'>
99
125
  data: string
100
126
  dataTransfer: DataTransfer
101
127
  mimeType: MIMEType
102
128
  }
103
129
  | {
104
- type: BehaviorEventType<'decorator', 'add'>
130
+ type: SyntheticBehaviorEventType<'decorator', 'add'>
105
131
  decorator: string
106
132
  offsets?: {anchor: BlockOffset; focus: BlockOffset}
107
133
  }
108
134
  | {
109
- type: BehaviorEventType<'decorator', 'remove'>
135
+ type: SyntheticBehaviorEventType<'decorator', 'remove'>
110
136
  decorator: string
111
137
  }
112
138
  | {
113
- type: BehaviorEventType<'decorator', 'toggle'>
139
+ type: SyntheticBehaviorEventType<'decorator', 'toggle'>
114
140
  decorator: string
115
141
  offsets?: {anchor: BlockOffset; focus: BlockOffset}
116
142
  }
117
143
  | {
118
- type: BehaviorEventType<'delete'>
144
+ type: SyntheticBehaviorEventType<'delete'>
119
145
  selection: NonNullable<EditorSelection>
120
146
  }
121
147
  | {
122
- type: BehaviorEventType<'delete', 'backward'>
148
+ type: SyntheticBehaviorEventType<'delete', 'backward'>
123
149
  unit: TextUnit
124
150
  }
125
151
  | {
126
- type: BehaviorEventType<'delete', 'block'>
152
+ type: SyntheticBehaviorEventType<'delete', 'block'>
127
153
  at: [KeyedSegment]
128
154
  }
129
155
  | {
130
- type: BehaviorEventType<'delete', 'forward'>
156
+ type: SyntheticBehaviorEventType<'delete', 'forward'>
131
157
  unit: TextUnit
132
158
  }
133
159
  | {
134
- type: BehaviorEventType<'delete', 'text'>
160
+ type: SyntheticBehaviorEventType<'delete', 'text'>
135
161
  anchor: BlockOffset
136
162
  focus: BlockOffset
137
163
  }
138
164
  | {
139
- type: BehaviorEventType<'focus'>
165
+ type: SyntheticBehaviorEventType<'focus'>
140
166
  }
141
167
  | {
142
- type: BehaviorEventType<'history', 'redo'>
168
+ type: SyntheticBehaviorEventType<'history', 'redo'>
143
169
  }
144
170
  | {
145
- type: BehaviorEventType<'history', 'undo'>
171
+ type: SyntheticBehaviorEventType<'history', 'undo'>
146
172
  }
147
173
  | {
148
- type: BehaviorEventType<'insert', 'blocks'>
174
+ type: SyntheticBehaviorEventType<'insert', 'blocks'>
149
175
  blocks: Array<PortableTextBlock>
150
176
  placement: InsertPlacement
151
177
  }
152
178
  | {
153
- type: BehaviorEventType<'insert', 'inline object'>
179
+ type: SyntheticBehaviorEventType<'insert', 'inline object'>
154
180
  inlineObject: {
155
181
  name: string
156
182
  value?: {[prop: string]: unknown}
157
183
  }
158
184
  }
159
185
  | {
160
- type: BehaviorEventType<'insert', 'break'>
186
+ type: SyntheticBehaviorEventType<'insert', 'break'>
161
187
  }
162
188
  | {
163
- type: BehaviorEventType<'insert', 'soft break'>
189
+ type: SyntheticBehaviorEventType<'insert', 'soft break'>
164
190
  }
165
191
  | {
166
- type: BehaviorEventType<'insert', 'block'>
192
+ type: SyntheticBehaviorEventType<'insert', 'block'>
167
193
  block: BlockWithOptionalKey
168
194
  placement: InsertPlacement
169
195
  select?: 'start' | 'end' | 'none'
170
196
  }
171
197
  | {
172
- type: BehaviorEventType<'insert', 'span'>
198
+ type: SyntheticBehaviorEventType<'insert', 'span'>
173
199
  text: string
174
200
  annotations?: Array<{
175
201
  name: string
@@ -178,61 +204,61 @@ export type SyntheticBehaviorEvent =
178
204
  decorators?: Array<string>
179
205
  }
180
206
  | {
181
- type: BehaviorEventType<'insert', 'text'>
207
+ type: SyntheticBehaviorEventType<'insert', 'text'>
182
208
  text: string
183
209
  options?: TextInsertTextOptions
184
210
  }
185
211
  | {
186
- type: BehaviorEventType<'list item', 'add'>
212
+ type: SyntheticBehaviorEventType<'list item', 'add'>
187
213
  listItem: string
188
214
  }
189
215
  | {
190
- type: BehaviorEventType<'list item', 'remove'>
216
+ type: SyntheticBehaviorEventType<'list item', 'remove'>
191
217
  listItem: string
192
218
  }
193
219
  | {
194
- type: BehaviorEventType<'list item', 'toggle'>
220
+ type: SyntheticBehaviorEventType<'list item', 'toggle'>
195
221
  listItem: string
196
222
  }
197
223
  | {
198
- type: BehaviorEventType<'move', 'block'>
224
+ type: SyntheticBehaviorEventType<'move', 'block'>
199
225
  at: [KeyedSegment]
200
226
  to: [KeyedSegment]
201
227
  }
202
228
  | {
203
- type: BehaviorEventType<'move', 'block down'>
229
+ type: SyntheticBehaviorEventType<'move', 'block down'>
204
230
  at: [KeyedSegment]
205
231
  }
206
232
  | {
207
- type: BehaviorEventType<'move', 'block up'>
233
+ type: SyntheticBehaviorEventType<'move', 'block up'>
208
234
  at: [KeyedSegment]
209
235
  }
210
236
  | {
211
- type: BehaviorEventType<'select'>
237
+ type: SyntheticBehaviorEventType<'select'>
212
238
  selection: EditorSelection
213
239
  }
214
240
  | {
215
- type: BehaviorEventType<'select', 'previous block'>
241
+ type: SyntheticBehaviorEventType<'select', 'previous block'>
216
242
  select?: 'start' | 'end'
217
243
  }
218
244
  | {
219
- type: BehaviorEventType<'select', 'next block'>
245
+ type: SyntheticBehaviorEventType<'select', 'next block'>
220
246
  select?: 'start' | 'end'
221
247
  }
222
248
  | {
223
- type: BehaviorEventType<'style', 'add'>
249
+ type: SyntheticBehaviorEventType<'style', 'add'>
224
250
  style: string
225
251
  }
226
252
  | {
227
- type: BehaviorEventType<'style', 'remove'>
253
+ type: SyntheticBehaviorEventType<'style', 'remove'>
228
254
  style: string
229
255
  }
230
256
  | {
231
- type: BehaviorEventType<'style', 'toggle'>
257
+ type: SyntheticBehaviorEventType<'style', 'toggle'>
232
258
  style: string
233
259
  }
234
260
  | {
235
- type: BehaviorEventType<'deserialization', 'success'>
261
+ type: SyntheticBehaviorEventType<'deserialization', 'success'>
236
262
  mimeType: MIMEType
237
263
  data: Array<PortableTextBlock>
238
264
  originEvent:
@@ -244,7 +270,7 @@ export type SyntheticBehaviorEvent =
244
270
  | InputBehaviorEvent
245
271
  }
246
272
  | {
247
- type: BehaviorEventType<'deserialization', 'failure'>
273
+ type: SyntheticBehaviorEventType<'deserialization', 'failure'>
248
274
  mimeType: MIMEType
249
275
  reason: string
250
276
  originEvent:
@@ -256,7 +282,7 @@ export type SyntheticBehaviorEvent =
256
282
  | InputBehaviorEvent
257
283
  }
258
284
  | {
259
- type: BehaviorEventType<'serialization', 'success'>
285
+ type: SyntheticBehaviorEventType<'serialization', 'success'>
260
286
  mimeType: MIMEType
261
287
  data: string
262
288
  originEvent: PickFromUnion<
@@ -266,7 +292,7 @@ export type SyntheticBehaviorEvent =
266
292
  >
267
293
  }
268
294
  | {
269
- type: BehaviorEventType<'serialization', 'failure'>
295
+ type: SyntheticBehaviorEventType<'serialization', 'failure'>
270
296
  mimeType: MIMEType
271
297
  reason: string
272
298
  originEvent: PickFromUnion<
@@ -278,23 +304,44 @@ export type SyntheticBehaviorEvent =
278
304
 
279
305
  export type InsertPlacement = 'auto' | 'after' | 'before'
280
306
 
307
+ /**************************************
308
+ * Native events
309
+ **************************************/
310
+
311
+ type NativeBehaviorEventNamespace =
312
+ | 'clipboard'
313
+ | 'drag'
314
+ | 'input'
315
+ | 'keyboard'
316
+ | 'mouse'
317
+
318
+ /**
319
+ * @beta
320
+ */
321
+ export type NativeBehaviorEvent =
322
+ | ClipboardBehaviorEvent
323
+ | DragBehaviorEvent
324
+ | InputBehaviorEvent
325
+ | KeyboardBehaviorEvent
326
+ | MouseBehaviorEvent
327
+
281
328
  type ClipboardBehaviorEvent =
282
329
  | {
283
- type: BehaviorEventType<'clipboard', 'copy'>
330
+ type: NativeBehaviorEventType<'clipboard', 'copy'>
284
331
  originEvent: {
285
332
  dataTransfer: DataTransfer
286
333
  }
287
334
  position: Pick<EventPosition, 'selection'>
288
335
  }
289
336
  | {
290
- type: BehaviorEventType<'clipboard', 'cut'>
337
+ type: NativeBehaviorEventType<'clipboard', 'cut'>
291
338
  originEvent: {
292
339
  dataTransfer: DataTransfer
293
340
  }
294
341
  position: Pick<EventPosition, 'selection'>
295
342
  }
296
343
  | {
297
- type: BehaviorEventType<'clipboard', 'paste'>
344
+ type: NativeBehaviorEventType<'clipboard', 'paste'>
298
345
  originEvent: {
299
346
  dataTransfer: DataTransfer
300
347
  }
@@ -309,47 +356,47 @@ export function isClipboardBehaviorEvent(
309
356
 
310
357
  type DragBehaviorEvent =
311
358
  | {
312
- type: BehaviorEventType<'drag', 'dragstart'>
359
+ type: NativeBehaviorEventType<'drag', 'dragstart'>
313
360
  originEvent: {
314
361
  dataTransfer: DataTransfer
315
362
  }
316
363
  position: Pick<EventPosition, 'selection'>
317
364
  }
318
365
  | {
319
- type: BehaviorEventType<'drag', 'drag'>
366
+ type: NativeBehaviorEventType<'drag', 'drag'>
320
367
  originEvent: {
321
368
  dataTransfer: DataTransfer
322
369
  }
323
370
  }
324
371
  | {
325
- type: BehaviorEventType<'drag', 'dragend'>
372
+ type: NativeBehaviorEventType<'drag', 'dragend'>
326
373
  originEvent: {
327
374
  dataTransfer: DataTransfer
328
375
  }
329
376
  }
330
377
  | {
331
- type: BehaviorEventType<'drag', 'dragenter'>
378
+ type: NativeBehaviorEventType<'drag', 'dragenter'>
332
379
  originEvent: {
333
380
  dataTransfer: DataTransfer
334
381
  }
335
382
  position: EventPosition
336
383
  }
337
384
  | {
338
- type: BehaviorEventType<'drag', 'dragover'>
385
+ type: NativeBehaviorEventType<'drag', 'dragover'>
339
386
  originEvent: {
340
387
  dataTransfer: DataTransfer
341
388
  }
342
389
  position: EventPosition
343
390
  }
344
391
  | {
345
- type: BehaviorEventType<'drag', 'drop'>
392
+ type: NativeBehaviorEventType<'drag', 'drop'>
346
393
  originEvent: {
347
394
  dataTransfer: DataTransfer
348
395
  }
349
396
  position: EventPosition
350
397
  }
351
398
  | {
352
- type: BehaviorEventType<'drag', 'dragleave'>
399
+ type: NativeBehaviorEventType<'drag', 'dragleave'>
353
400
  originEvent: {
354
401
  dataTransfer: DataTransfer
355
402
  }
@@ -373,7 +420,7 @@ export function isDragBehaviorEvent(
373
420
  * - insertFromYank
374
421
  */
375
422
  export type InputBehaviorEvent = {
376
- type: BehaviorEventType<'input', '*'>
423
+ type: NativeBehaviorEventType<'input', '*'>
377
424
  originEvent: {
378
425
  dataTransfer: DataTransfer
379
426
  }
@@ -387,14 +434,14 @@ export function isInputBehaviorEvent(
387
434
 
388
435
  export type KeyboardBehaviorEvent =
389
436
  | {
390
- type: BehaviorEventType<'keyboard', 'keydown'>
437
+ type: NativeBehaviorEventType<'keyboard', 'keydown'>
391
438
  originEvent: Pick<
392
439
  KeyboardEvent,
393
440
  'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
394
441
  >
395
442
  }
396
443
  | {
397
- type: BehaviorEventType<'keyboard', 'keyup'>
444
+ type: NativeBehaviorEventType<'keyboard', 'keyup'>
398
445
  originEvent: Pick<
399
446
  KeyboardEvent,
400
447
  'key' | 'code' | 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'
@@ -407,9 +454,9 @@ export function isKeyboardBehaviorEvent(
407
454
  return event.type.startsWith('keyboard.')
408
455
  }
409
456
 
410
- export type DataBehaviorEvent =
457
+ export type InternalBehaviorEvent =
411
458
  | {
412
- type: BehaviorEventType<'deserialize'>
459
+ type: InternalBehaviorEventType<'deserialize'>
413
460
  originEvent:
414
461
  | PickFromUnion<
415
462
  NativeBehaviorEvent,
@@ -419,7 +466,7 @@ export type DataBehaviorEvent =
419
466
  | InputBehaviorEvent
420
467
  }
421
468
  | {
422
- type: BehaviorEventType<'serialize'>
469
+ type: InternalBehaviorEventType<'serialize'>
423
470
  originEvent: PickFromUnion<
424
471
  NativeBehaviorEvent,
425
472
  'type',
@@ -428,7 +475,7 @@ export type DataBehaviorEvent =
428
475
  }
429
476
 
430
477
  export type MouseBehaviorEvent = {
431
- type: BehaviorEventType<'mouse', 'click'>
478
+ type: NativeBehaviorEventType<'mouse', 'click'>
432
479
  position: EventPosition
433
480
  }
434
481
 
@@ -438,15 +485,11 @@ export function isMouseBehaviorEvent(
438
485
  return event.type.startsWith('mouse.')
439
486
  }
440
487
 
441
- /**
442
- * @beta
443
- */
444
- export type NativeBehaviorEvent =
445
- | ClipboardBehaviorEvent
446
- | DragBehaviorEvent
447
- | InputBehaviorEvent
448
- | KeyboardBehaviorEvent
449
- | MouseBehaviorEvent
488
+ /**************************************
489
+ * Custom events
490
+ **************************************/
491
+
492
+ type CustomBehaviorEventNamespace = 'custom'
450
493
 
451
494
  /**
452
495
  * @beta
@@ -454,10 +497,10 @@ export type NativeBehaviorEvent =
454
497
  export type CustomBehaviorEvent<
455
498
  TPayload extends Record<string, unknown> = Record<string, unknown>,
456
499
  TType extends string = string,
457
- TInternalType extends BehaviorEventType<'custom', TType> = BehaviorEventType<
500
+ TInternalType extends CustomBehaviorEventType<
458
501
  'custom',
459
502
  TType
460
- >,
503
+ > = CustomBehaviorEventType<'custom', TType>,
461
504
  > = {
462
505
  type: TInternalType
463
506
  } & TPayload
@@ -475,7 +518,10 @@ export type BehaviorAction =
475
518
  | SyntheticBehaviorEvent
476
519
  | {
477
520
  type: 'raise'
478
- event: DataBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent
521
+ event:
522
+ | InternalBehaviorEvent
523
+ | SyntheticBehaviorEvent
524
+ | CustomBehaviorEvent
479
525
  }
480
526
  | {
481
527
  type: 'noop'
@@ -485,6 +531,12 @@ export type BehaviorAction =
485
531
  effect: () => void
486
532
  }
487
533
 
534
+ /**************************************
535
+ * Internal events
536
+ **************************************/
537
+
538
+ type InternalBehaviorEventNamespace = 'deserialize' | 'serialize'
539
+
488
540
  export type InternalBehaviorAction = OmitFromUnion<
489
541
  BehaviorAction,
490
542
  'type',
@@ -497,20 +549,11 @@ export type InternalBehaviorAction = OmitFromUnion<
497
549
  * @beta
498
550
  */
499
551
  export function raise(
500
- event: DataBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent,
552
+ event: InternalBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent,
501
553
  ): PickFromUnion<BehaviorAction, 'type', 'raise'> {
502
554
  return {type: 'raise', event}
503
555
  }
504
556
 
505
- /**
506
- * @beta
507
- */
508
- export type BehaviorEvent =
509
- | SyntheticBehaviorEvent
510
- | DataBehaviorEvent
511
- | NativeBehaviorEvent
512
- | CustomBehaviorEvent
513
-
514
557
  type ResolveBehaviorEvent<
515
558
  TBehaviorEventType extends
516
559
  | '*'
@@ -1122,16 +1122,6 @@ export const PortableTextEditable = forwardRef<
1122
1122
  return
1123
1123
  }
1124
1124
 
1125
- const snapshot = getEditorSnapshot({
1126
- editorActorSnapshot: editorActor.getSnapshot(),
1127
- slateEditorInstance: slateEditor,
1128
- })
1129
-
1130
- if (draggingOnDragOrigin({snapshot, position})) {
1131
- event.preventDefault()
1132
- return
1133
- }
1134
-
1135
1125
  editorActor.send({
1136
1126
  type: 'behavior event',
1137
1127
  behaviorEvent: {
@@ -1192,16 +1182,6 @@ export const PortableTextEditable = forwardRef<
1192
1182
  return
1193
1183
  }
1194
1184
 
1195
- const snapshot = getEditorSnapshot({
1196
- editorActorSnapshot: editorActor.getSnapshot(),
1197
- slateEditorInstance: slateEditor,
1198
- })
1199
-
1200
- if (draggingOnDragOrigin({snapshot, position})) {
1201
- event.preventDefault()
1202
- return
1203
- }
1204
-
1205
1185
  editorActor.send({
1206
1186
  type: 'behavior event',
1207
1187
  behaviorEvent: {
@@ -1245,7 +1225,6 @@ export const PortableTextEditable = forwardRef<
1245
1225
 
1246
1226
  if (draggingOnDragOrigin({snapshot, position})) {
1247
1227
  event.preventDefault()
1248
- return
1249
1228
  }
1250
1229
 
1251
1230
  editorActor.send({
@@ -1286,16 +1265,6 @@ export const PortableTextEditable = forwardRef<
1286
1265
  return
1287
1266
  }
1288
1267
 
1289
- const snapshot = getEditorSnapshot({
1290
- editorActorSnapshot: editorActor.getSnapshot(),
1291
- slateEditorInstance: slateEditor,
1292
- })
1293
-
1294
- if (draggingOnDragOrigin({snapshot, position})) {
1295
- event.preventDefault()
1296
- return
1297
- }
1298
-
1299
1268
  editorActor.send({
1300
1269
  type: 'behavior event',
1301
1270
  behaviorEvent: {
@@ -1341,16 +1310,6 @@ export const PortableTextEditable = forwardRef<
1341
1310
  return
1342
1311
  }
1343
1312
 
1344
- const snapshot = getEditorSnapshot({
1345
- editorActorSnapshot: editorActor.getSnapshot(),
1346
- slateEditorInstance: slateEditor,
1347
- })
1348
-
1349
- if (draggingOnDragOrigin({snapshot, position})) {
1350
- event.preventDefault()
1351
- return
1352
- }
1353
-
1354
1313
  editorActor.send({
1355
1314
  type: 'behavior event',
1356
1315
  behaviorEvent: {
@@ -14,7 +14,7 @@ import {
14
14
  import type {
15
15
  Behavior,
16
16
  CustomBehaviorEvent,
17
- ExternalBehaviorEvent,
17
+ ExternalSyntheticBehaviorEvent,
18
18
  SyntheticBehaviorEvent,
19
19
  } from '../behaviors/behavior.types'
20
20
  import {coreConverters} from '../converters/converters.core'
@@ -65,7 +65,7 @@ export type EditorConfig = {
65
65
  */
66
66
  export type EditorEvent =
67
67
  | ExternalEditorEvent
68
- | ExternalBehaviorEvent
68
+ | ExternalSyntheticBehaviorEvent
69
69
  | SyntheticBehaviorEvent
70
70
  | CustomBehaviorEvent
71
71