@portabletext/editor 1.41.4 → 1.42.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.
Files changed (52) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +2 -26
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  4. package/lib/_chunks-cjs/editor-provider.cjs +21 -4
  5. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  6. package/lib/_chunks-es/behavior.core.js +2 -26
  7. package/lib/_chunks-es/behavior.core.js.map +1 -1
  8. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  9. package/lib/_chunks-es/editor-provider.js +20 -3
  10. package/lib/_chunks-es/editor-provider.js.map +1 -1
  11. package/lib/behaviors/index.cjs.map +1 -1
  12. package/lib/behaviors/index.d.cts +16 -86
  13. package/lib/behaviors/index.d.ts +16 -86
  14. package/lib/behaviors/index.js.map +1 -1
  15. package/lib/index.d.cts +7 -68
  16. package/lib/index.d.ts +7 -68
  17. package/lib/plugins/index.cjs +7 -1
  18. package/lib/plugins/index.cjs.map +1 -1
  19. package/lib/plugins/index.d.cts +12 -68
  20. package/lib/plugins/index.d.ts +12 -68
  21. package/lib/plugins/index.js +8 -2
  22. package/lib/plugins/index.js.map +1 -1
  23. package/lib/selectors/index.d.cts +7 -68
  24. package/lib/selectors/index.d.ts +7 -68
  25. package/lib/utils/index.d.cts +7 -68
  26. package/lib/utils/index.d.ts +7 -68
  27. package/package.json +4 -4
  28. package/src/behavior-actions/behavior.actions.ts +1 -1
  29. package/src/behaviors/behavior.code-editor.ts +1 -1
  30. package/src/behaviors/behavior.core.annotations.ts +2 -1
  31. package/src/behaviors/behavior.core.block-objects.ts +2 -1
  32. package/src/behaviors/behavior.core.decorators.ts +2 -1
  33. package/src/behaviors/behavior.core.dnd.ts +1 -1
  34. package/src/behaviors/behavior.core.insert-break.ts +2 -1
  35. package/src/behaviors/behavior.core.lists.ts +2 -1
  36. package/src/behaviors/behavior.decorator-pair.ts +1 -1
  37. package/src/behaviors/behavior.default.raise-soft-break.ts +2 -1
  38. package/src/behaviors/behavior.default.ts +2 -1
  39. package/src/behaviors/behavior.emoji-picker.ts +1 -1
  40. package/src/behaviors/behavior.links.ts +1 -1
  41. package/src/behaviors/behavior.markdown.ts +1 -1
  42. package/src/behaviors/behavior.types.action.ts +61 -0
  43. package/src/behaviors/behavior.types.behavior.ts +84 -0
  44. package/src/behaviors/{behavior.types.ts → behavior.types.event.ts} +58 -203
  45. package/src/behaviors/behavior.types.guard.ts +14 -0
  46. package/src/behaviors/index.ts +11 -9
  47. package/src/editor/create-editor.ts +2 -2
  48. package/src/editor/editor-machine.ts +3 -3
  49. package/src/editor/plugins/create-with-event-listeners.ts +0 -1
  50. package/src/plugins/index.ts +1 -0
  51. package/src/plugins/plugin.core.tsx +9 -0
  52. package/src/plugins/plugin.decorator-shortcut.ts +1 -1
@@ -3,7 +3,7 @@ import type {EditorSchema} from '../editor/define-schema'
3
3
  import * as selectors from '../selectors'
4
4
  import {spanSelectionPointToBlockOffset} from '../utils/util.block-offset'
5
5
  import {getTextBlockText} from '../utils/util.get-text-block-text'
6
- import {defineBehavior} from './behavior.types'
6
+ import {defineBehavior} from './behavior.types.behavior'
7
7
 
8
8
  /**
9
9
  * @beta
@@ -0,0 +1,61 @@
1
+ import type {EditorContext, EditorSnapshot} from '../editor/editor-snapshot'
2
+ import type {OmitFromUnion, PickFromUnion} from '../type-utils'
3
+ import type {PortableTextSlateEditor} from '../types/editor'
4
+ import type {
5
+ CustomBehaviorEvent,
6
+ InternalBehaviorEvent,
7
+ SyntheticBehaviorEvent,
8
+ } from './behavior.types.event'
9
+
10
+ /**
11
+ * @beta
12
+ */
13
+ export type BehaviorAction =
14
+ | SyntheticBehaviorEvent
15
+ | {
16
+ type: 'raise'
17
+ event:
18
+ | InternalBehaviorEvent
19
+ | SyntheticBehaviorEvent
20
+ | CustomBehaviorEvent
21
+ }
22
+ | {
23
+ type: 'noop'
24
+ }
25
+ | {
26
+ type: 'effect'
27
+ effect: () => void
28
+ }
29
+
30
+ /**
31
+ * @beta
32
+ */
33
+ export function raise(
34
+ event: InternalBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent,
35
+ ): PickFromUnion<BehaviorAction, 'type', 'raise'> {
36
+ return {type: 'raise', event}
37
+ }
38
+
39
+ /**
40
+ * @beta
41
+ */
42
+ export type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
43
+ payload: {
44
+ /**
45
+ * @deprecated
46
+ * Use `snapshot` instead
47
+ */
48
+ context: EditorContext
49
+ snapshot: EditorSnapshot
50
+ event: TBehaviorEvent
51
+ },
52
+ guardResponse: TGuardResponse,
53
+ ) => Array<BehaviorAction>
54
+
55
+ export type InternalBehaviorAction = OmitFromUnion<
56
+ BehaviorAction,
57
+ 'type',
58
+ 'raise'
59
+ > & {
60
+ editor: PortableTextSlateEditor
61
+ }
@@ -0,0 +1,84 @@
1
+ import type {BehaviorActionSet} from './behavior.types.action'
2
+ import type {
3
+ BehaviorEvent,
4
+ BehaviorEventTypeNamespace,
5
+ CustomBehaviorEvent,
6
+ ResolveBehaviorEvent,
7
+ } from './behavior.types.event'
8
+ import type {BehaviorGuard} from './behavior.types.guard'
9
+
10
+ /**
11
+ * @beta
12
+ */
13
+ export type Behavior<
14
+ TBehaviorEventType extends
15
+ | '*'
16
+ | `${BehaviorEventTypeNamespace}.*`
17
+ | BehaviorEvent['type'] =
18
+ | '*'
19
+ | `${BehaviorEventTypeNamespace}.*`
20
+ | BehaviorEvent['type'],
21
+ TGuardResponse = true,
22
+ TBehaviorEvent extends
23
+ ResolveBehaviorEvent<TBehaviorEventType> = ResolveBehaviorEvent<TBehaviorEventType>,
24
+ > = {
25
+ /**
26
+ * The internal editor event that triggers this behavior.
27
+ */
28
+ on: TBehaviorEventType
29
+ /**
30
+ * Predicate function that determines if the behavior should be executed.
31
+ * Returning a non-nullable value from the guard will pass the value to the
32
+ * actions and execute them.
33
+ */
34
+ guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>
35
+ /**
36
+ * Array of behavior action sets.
37
+ */
38
+ actions: Array<BehaviorActionSet<TBehaviorEvent, TGuardResponse>>
39
+ }
40
+
41
+ /**
42
+ * @beta
43
+ *
44
+ * @example
45
+ *
46
+ * ```tsx
47
+ * const noLowerCaseA = defineBehavior({
48
+ * on: 'insert.text',
49
+ * guard: ({event, snapshot}) => event.text === 'a',
50
+ * actions: [({event, snapshot}) => [{type: 'insert.text', text: 'A'}]],
51
+ * })
52
+ * ```
53
+ *
54
+ */
55
+ export function defineBehavior<
56
+ TPayload extends Record<string, unknown>,
57
+ TBehaviorEventType extends
58
+ | '*'
59
+ | `${BehaviorEventTypeNamespace}.*`
60
+ | BehaviorEvent['type'] = CustomBehaviorEvent['type'],
61
+ TGuardResponse = true,
62
+ >(
63
+ behavior: Behavior<
64
+ TBehaviorEventType,
65
+ TGuardResponse,
66
+ ResolveBehaviorEvent<TBehaviorEventType, TPayload>
67
+ >,
68
+ ): Behavior
69
+ export function defineBehavior<
70
+ TPayload extends never = never,
71
+ TBehaviorEventType extends
72
+ | '*'
73
+ | `${BehaviorEventTypeNamespace}.*`
74
+ | BehaviorEvent['type'] = BehaviorEvent['type'],
75
+ TGuardResponse = true,
76
+ TBehaviorEvent extends ResolveBehaviorEvent<
77
+ TBehaviorEventType,
78
+ TPayload
79
+ > = ResolveBehaviorEvent<TBehaviorEventType, TPayload>,
80
+ >(
81
+ behavior: Behavior<TBehaviorEventType, TGuardResponse, TBehaviorEvent>,
82
+ ): Behavior {
83
+ return behavior as unknown as Behavior
84
+ }
@@ -1,13 +1,11 @@
1
1
  import type {KeyedSegment, PortableTextBlock} from '@sanity/types'
2
2
  import type {TextUnit} from 'slate'
3
- import type {TextInsertTextOptions} from 'slate/dist/interfaces/transforms/text'
4
- import type {EditorContext, EditorSnapshot} from '../editor/editor-snapshot'
5
3
  import type {EventPosition} from '../internal-utils/event-position'
6
4
  import type {MIMEType} from '../internal-utils/mime-type'
7
- import type {OmitFromUnion, PickFromUnion} from '../type-utils'
5
+ import type {PickFromUnion} from '../type-utils'
8
6
  import type {BlockOffset} from '../types/block-offset'
9
7
  import type {BlockWithOptionalKey} from '../types/block-with-optional-key'
10
- import type {EditorSelection, PortableTextSlateEditor} from '../types/editor'
8
+ import type {EditorSelection} from '../types/editor'
11
9
 
12
10
  /**
13
11
  * @beta
@@ -18,33 +16,13 @@ export type BehaviorEvent =
18
16
  | NativeBehaviorEvent
19
17
  | CustomBehaviorEvent
20
18
 
21
- type BehaviorEventTypeNamespace =
19
+ export type BehaviorEventTypeNamespace =
22
20
  | SyntheticBehaviorEventNamespace
23
21
  | InternalBehaviorEventNamespace
24
22
  | NativeBehaviorEventNamespace
25
23
  | CustomBehaviorEventNamespace
26
24
 
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
-
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,
44
- TType extends string = '',
45
- > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
46
-
47
- export type NamespacedBehaviorEventType<
25
+ type NamespacedBehaviorEventType<
48
26
  TNamespace extends BehaviorEventTypeNamespace | '',
49
27
  > = TNamespace extends ''
50
28
  ? BehaviorEvent['type']
@@ -66,6 +44,11 @@ export type ExternalSyntheticBehaviorEvent = {
66
44
  * Synthetic events
67
45
  **************************************/
68
46
 
47
+ type SyntheticBehaviorEventType<
48
+ TNamespace extends SyntheticBehaviorEventNamespace,
49
+ TType extends string = '',
50
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
51
+
69
52
  type SyntheticBehaviorEventNamespace =
70
53
  | 'annotation'
71
54
  | 'block'
@@ -206,7 +189,6 @@ export type SyntheticBehaviorEvent =
206
189
  | {
207
190
  type: SyntheticBehaviorEventType<'insert', 'text'>
208
191
  text: string
209
- options?: TextInsertTextOptions
210
192
  }
211
193
  | {
212
194
  type: SyntheticBehaviorEventType<'list item', 'add'>
@@ -304,6 +286,43 @@ export type SyntheticBehaviorEvent =
304
286
 
305
287
  export type InsertPlacement = 'auto' | 'after' | 'before'
306
288
 
289
+ export function isKeyboardBehaviorEvent(
290
+ event: BehaviorEvent,
291
+ ): event is KeyboardBehaviorEvent {
292
+ return event.type.startsWith('keyboard.')
293
+ }
294
+
295
+ /**************************************
296
+ * Internal events
297
+ **************************************/
298
+
299
+ type InternalBehaviorEventNamespace = 'deserialize' | 'serialize'
300
+
301
+ type InternalBehaviorEventType<
302
+ TNamespace extends InternalBehaviorEventNamespace,
303
+ TType extends string = '',
304
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
305
+
306
+ export type InternalBehaviorEvent =
307
+ | {
308
+ type: InternalBehaviorEventType<'deserialize'>
309
+ originEvent:
310
+ | PickFromUnion<
311
+ NativeBehaviorEvent,
312
+ 'type',
313
+ 'drag.drop' | 'clipboard.paste'
314
+ >
315
+ | InputBehaviorEvent
316
+ }
317
+ | {
318
+ type: InternalBehaviorEventType<'serialize'>
319
+ originEvent: PickFromUnion<
320
+ NativeBehaviorEvent,
321
+ 'type',
322
+ 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
323
+ >
324
+ }
325
+
307
326
  /**************************************
308
327
  * Native events
309
328
  **************************************/
@@ -315,6 +334,11 @@ type NativeBehaviorEventNamespace =
315
334
  | 'keyboard'
316
335
  | 'mouse'
317
336
 
337
+ type NativeBehaviorEventType<
338
+ TNamespace extends NativeBehaviorEventNamespace,
339
+ TType extends string = '',
340
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
341
+
318
342
  /**
319
343
  * @beta
320
344
  */
@@ -448,32 +472,6 @@ export type KeyboardBehaviorEvent =
448
472
  >
449
473
  }
450
474
 
451
- export function isKeyboardBehaviorEvent(
452
- event: BehaviorEvent,
453
- ): event is KeyboardBehaviorEvent {
454
- return event.type.startsWith('keyboard.')
455
- }
456
-
457
- export type InternalBehaviorEvent =
458
- | {
459
- type: InternalBehaviorEventType<'deserialize'>
460
- originEvent:
461
- | PickFromUnion<
462
- NativeBehaviorEvent,
463
- 'type',
464
- 'drag.drop' | 'clipboard.paste'
465
- >
466
- | InputBehaviorEvent
467
- }
468
- | {
469
- type: InternalBehaviorEventType<'serialize'>
470
- originEvent: PickFromUnion<
471
- NativeBehaviorEvent,
472
- 'type',
473
- 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
474
- >
475
- }
476
-
477
475
  export type MouseBehaviorEvent = {
478
476
  type: NativeBehaviorEventType<'mouse', 'click'>
479
477
  position: EventPosition
@@ -491,6 +489,11 @@ export function isMouseBehaviorEvent(
491
489
 
492
490
  type CustomBehaviorEventNamespace = 'custom'
493
491
 
492
+ type CustomBehaviorEventType<
493
+ TNamespace extends CustomBehaviorEventNamespace,
494
+ TType extends string = '',
495
+ > = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
496
+
494
497
  /**
495
498
  * @beta
496
499
  */
@@ -511,50 +514,11 @@ export function isCustomBehaviorEvent(
511
514
  return event.type.startsWith('custom.')
512
515
  }
513
516
 
514
- /**
515
- * @beta
516
- */
517
- export type BehaviorAction =
518
- | SyntheticBehaviorEvent
519
- | {
520
- type: 'raise'
521
- event:
522
- | InternalBehaviorEvent
523
- | SyntheticBehaviorEvent
524
- | CustomBehaviorEvent
525
- }
526
- | {
527
- type: 'noop'
528
- }
529
- | {
530
- type: 'effect'
531
- effect: () => void
532
- }
533
-
534
517
  /**************************************
535
- * Internal events
518
+ * Resolve behavior event
536
519
  **************************************/
537
520
 
538
- type InternalBehaviorEventNamespace = 'deserialize' | 'serialize'
539
-
540
- export type InternalBehaviorAction = OmitFromUnion<
541
- BehaviorAction,
542
- 'type',
543
- 'raise'
544
- > & {
545
- editor: PortableTextSlateEditor
546
- }
547
-
548
- /**
549
- * @beta
550
- */
551
- export function raise(
552
- event: InternalBehaviorEvent | SyntheticBehaviorEvent | CustomBehaviorEvent,
553
- ): PickFromUnion<BehaviorAction, 'type', 'raise'> {
554
- return {type: 'raise', event}
555
- }
556
-
557
- type ResolveBehaviorEvent<
521
+ export type ResolveBehaviorEvent<
558
522
  TBehaviorEventType extends
559
523
  | '*'
560
524
  | `${BehaviorEventTypeNamespace}.*`
@@ -575,112 +539,3 @@ type ResolveBehaviorEvent<
575
539
  : TBehaviorEventType extends BehaviorEvent['type']
576
540
  ? PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>
577
541
  : never
578
-
579
- /**
580
- * @beta
581
- */
582
- export type Behavior<
583
- TBehaviorEventType extends
584
- | '*'
585
- | `${BehaviorEventTypeNamespace}.*`
586
- | BehaviorEvent['type'] =
587
- | '*'
588
- | `${BehaviorEventTypeNamespace}.*`
589
- | BehaviorEvent['type'],
590
- TGuardResponse = true,
591
- TBehaviorEvent extends
592
- ResolveBehaviorEvent<TBehaviorEventType> = ResolveBehaviorEvent<TBehaviorEventType>,
593
- > = {
594
- /**
595
- * The internal editor event that triggers this behavior.
596
- */
597
- on: TBehaviorEventType
598
- /**
599
- * Predicate function that determines if the behavior should be executed.
600
- * Returning a non-nullable value from the guard will pass the value to the
601
- * actions and execute them.
602
- */
603
- guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>
604
- /**
605
- * Array of behavior action sets.
606
- */
607
- actions: Array<BehaviorActionSet<TBehaviorEvent, TGuardResponse>>
608
- }
609
-
610
- /**
611
- * @beta
612
- */
613
- export type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
614
- /**
615
- * @deprecated
616
- * Use `snapshot` instead
617
- */
618
- context: EditorContext
619
- snapshot: EditorSnapshot
620
- event: TBehaviorEvent
621
- }) => TGuardResponse | false
622
-
623
- /**
624
- * @beta
625
- */
626
- export type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
627
- payload: {
628
- /**
629
- * @deprecated
630
- * Use `snapshot` instead
631
- */
632
- context: EditorContext
633
- snapshot: EditorSnapshot
634
- event: TBehaviorEvent
635
- },
636
- guardResponse: TGuardResponse,
637
- ) => Array<BehaviorAction>
638
-
639
- /**
640
- * @beta
641
- *
642
- * @example
643
- *
644
- * ```tsx
645
- * const noLowerCaseA = defineBehavior({
646
- * on: 'insert.text',
647
- * guard: ({event, context}) => event.text === 'a',
648
- * actions: [({event, context}) => [{type: 'insert.text', text: 'A'}]],
649
- * })
650
- * ```
651
- *
652
- *
653
- *
654
- *
655
- *
656
- */
657
- export function defineBehavior<
658
- TPayload extends Record<string, unknown>,
659
- TBehaviorEventType extends
660
- | '*'
661
- | `${BehaviorEventTypeNamespace}.*`
662
- | BehaviorEvent['type'] = CustomBehaviorEvent['type'],
663
- TGuardResponse = true,
664
- >(
665
- behavior: Behavior<
666
- TBehaviorEventType,
667
- TGuardResponse,
668
- ResolveBehaviorEvent<TBehaviorEventType, TPayload>
669
- >,
670
- ): Behavior
671
- export function defineBehavior<
672
- TPayload extends never = never,
673
- TBehaviorEventType extends
674
- | '*'
675
- | `${BehaviorEventTypeNamespace}.*`
676
- | BehaviorEvent['type'] = BehaviorEvent['type'],
677
- TGuardResponse = true,
678
- TBehaviorEvent extends ResolveBehaviorEvent<
679
- TBehaviorEventType,
680
- TPayload
681
- > = ResolveBehaviorEvent<TBehaviorEventType, TPayload>,
682
- >(
683
- behavior: Behavior<TBehaviorEventType, TGuardResponse, TBehaviorEvent>,
684
- ): Behavior {
685
- return behavior as unknown as Behavior
686
- }
@@ -0,0 +1,14 @@
1
+ import type {EditorContext, EditorSnapshot} from '../editor/editor-snapshot'
2
+
3
+ /**
4
+ * @beta
5
+ */
6
+ export type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
7
+ /**
8
+ * @deprecated
9
+ * Use `snapshot` instead
10
+ */
11
+ context: EditorContext
12
+ snapshot: EditorSnapshot
13
+ event: TBehaviorEvent
14
+ }) => TGuardResponse | false
@@ -4,23 +4,25 @@ export {
4
4
  } from './behavior.code-editor'
5
5
  export {coreBehaviors} from './behavior.core'
6
6
  export {
7
- type EmojiPickerBehaviorsConfig,
8
7
  createEmojiPickerBehaviors,
8
+ type EmojiPickerBehaviorsConfig,
9
9
  } from './behavior.emoji-picker'
10
10
  export {createLinkBehaviors, type LinkBehaviorsConfig} from './behavior.links'
11
11
  export {
12
12
  createMarkdownBehaviors,
13
13
  type MarkdownBehaviorsConfig,
14
14
  } from './behavior.markdown'
15
+
15
16
  export {
16
- defineBehavior,
17
17
  raise,
18
- type Behavior,
19
18
  type BehaviorAction,
20
19
  type BehaviorActionSet,
21
- type BehaviorEvent,
22
- type BehaviorGuard,
23
- type CustomBehaviorEvent,
24
- type NativeBehaviorEvent,
25
- type SyntheticBehaviorEvent,
26
- } from './behavior.types'
20
+ } from './behavior.types.action'
21
+ export {defineBehavior, type Behavior} from './behavior.types.behavior'
22
+ export type {
23
+ BehaviorEvent,
24
+ CustomBehaviorEvent,
25
+ NativeBehaviorEvent,
26
+ SyntheticBehaviorEvent,
27
+ } from './behavior.types.event'
28
+ export type {BehaviorGuard} from './behavior.types.guard'
@@ -11,12 +11,12 @@ import {
11
11
  type EventObject,
12
12
  type Snapshot,
13
13
  } from 'xstate'
14
+ import type {Behavior} from '../behaviors/behavior.types.behavior'
14
15
  import type {
15
- Behavior,
16
16
  CustomBehaviorEvent,
17
17
  ExternalSyntheticBehaviorEvent,
18
18
  SyntheticBehaviorEvent,
19
- } from '../behaviors/behavior.types'
19
+ } from '../behaviors/behavior.types.event'
20
20
  import {coreConverters} from '../converters/converters.core'
21
21
  import {compileType} from '../internal-utils/schema'
22
22
  import type {EditableAPI} from '../types/editor'
@@ -12,6 +12,8 @@ import {
12
12
  import {performAction} from '../behavior-actions/behavior.actions'
13
13
  import {coreBehaviors} from '../behaviors/behavior.core'
14
14
  import {defaultBehaviors} from '../behaviors/behavior.default'
15
+ import type {InternalBehaviorAction} from '../behaviors/behavior.types.action'
16
+ import type {Behavior} from '../behaviors/behavior.types.behavior'
15
17
  import {
16
18
  isClipboardBehaviorEvent,
17
19
  isCustomBehaviorEvent,
@@ -19,14 +21,12 @@ import {
19
21
  isInputBehaviorEvent,
20
22
  isKeyboardBehaviorEvent,
21
23
  isMouseBehaviorEvent,
22
- type Behavior,
23
24
  type CustomBehaviorEvent,
24
25
  type ExternalSyntheticBehaviorEvent,
25
- type InternalBehaviorAction,
26
26
  type InternalBehaviorEvent,
27
27
  type NativeBehaviorEvent,
28
28
  type SyntheticBehaviorEvent,
29
- } from '../behaviors/behavior.types'
29
+ } from '../behaviors/behavior.types.event'
30
30
  import type {Converter} from '../converters/converter.types'
31
31
  import type {EventPosition} from '../internal-utils/event-position'
32
32
  import type {NamespaceEvent} from '../type-utils'
@@ -179,7 +179,6 @@ export function createWithEventListeners(
179
179
  behaviorEvent: {
180
180
  type: 'insert.text',
181
181
  text,
182
- options,
183
182
  },
184
183
  editor,
185
184
  defaultActionCallback: () => {
@@ -1,4 +1,5 @@
1
1
  export {BehaviorPlugin} from './plugin.behavior'
2
+ export {CoreBehaviorsPlugin} from './plugin.core'
2
3
  export {DecoratorShortcutPlugin} from './plugin.decorator-shortcut'
3
4
  export {EditorRefPlugin} from './plugin.editor-ref'
4
5
  export {EventListenerPlugin} from './plugin.event-listener'
@@ -0,0 +1,9 @@
1
+ import {coreBehaviors} from '../behaviors'
2
+ import {BehaviorPlugin} from './plugin.behavior'
3
+
4
+ /**
5
+ * @beta
6
+ */
7
+ export function CoreBehaviorsPlugin() {
8
+ return <BehaviorPlugin behaviors={coreBehaviors} />
9
+ }
@@ -8,7 +8,7 @@ import {
8
8
  type CallbackLogicFunction,
9
9
  } from 'xstate'
10
10
  import {createDecoratorPairBehavior} from '../behaviors/behavior.decorator-pair'
11
- import {defineBehavior} from '../behaviors/behavior.types'
11
+ import {defineBehavior} from '../behaviors/behavior.types.behavior'
12
12
  import type {Editor} from '../editor/create-editor'
13
13
  import type {EditorSchema} from '../editor/define-schema'
14
14
  import {useEditor} from '../editor/editor-provider'