@portabletext/editor 3.1.2 → 3.2.1

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": "3.1.2",
3
+ "version": "3.2.1",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@sanity/diff-match-patch": "^3.2.0",
83
- "@sanity/pkg-utils": "^9.0.3",
83
+ "@sanity/pkg-utils": "^10.0.0",
84
84
  "@sanity/schema": "^4.20.0",
85
85
  "@sanity/types": "^4.20.0",
86
86
  "@types/debug": "^4.1.12",
@@ -16,6 +16,11 @@ export const abstractSerializeBehaviors = [
16
16
  mimeType: 'application/json',
17
17
  originEvent: event.originEvent,
18
18
  }),
19
+ raise({
20
+ type: 'serialize.data',
21
+ mimeType: 'text/markdown',
22
+ originEvent: event.originEvent,
23
+ }),
19
24
  raise({
20
25
  type: 'serialize.data',
21
26
  mimeType: 'text/html',
@@ -19,8 +19,8 @@ export type Behavior<
19
19
  | `${BehaviorEventTypeNamespace}.*`
20
20
  | BehaviorEvent['type'],
21
21
  TGuardResponse = true,
22
- TBehaviorEvent extends
23
- ResolveBehaviorEvent<TBehaviorEventType> = ResolveBehaviorEvent<TBehaviorEventType>,
22
+ TBehaviorEvent extends ResolveBehaviorEvent<TBehaviorEventType> =
23
+ ResolveBehaviorEvent<TBehaviorEventType>,
24
24
  > = {
25
25
  /**
26
26
  * Editor Event that triggers this Behavior.
@@ -74,10 +74,8 @@ export function defineBehavior<
74
74
  | `${BehaviorEventTypeNamespace}.*`
75
75
  | BehaviorEvent['type'] = BehaviorEvent['type'],
76
76
  TGuardResponse = true,
77
- TBehaviorEvent extends ResolveBehaviorEvent<
78
- TBehaviorEventType,
79
- TPayload
80
- > = ResolveBehaviorEvent<TBehaviorEventType, TPayload>,
77
+ TBehaviorEvent extends ResolveBehaviorEvent<TBehaviorEventType, TPayload> =
78
+ ResolveBehaviorEvent<TBehaviorEventType, TPayload>,
81
79
  >(
82
80
  behavior: Behavior<TBehaviorEventType, TGuardResponse, TBehaviorEvent>,
83
81
  ): Behavior {
@@ -625,10 +625,8 @@ type CustomBehaviorEventType<
625
625
  export type CustomBehaviorEvent<
626
626
  TPayload extends Record<string, unknown> = Record<string, unknown>,
627
627
  TType extends string = string,
628
- TInternalType extends CustomBehaviorEventType<
629
- 'custom',
630
- TType
631
- > = CustomBehaviorEventType<'custom', TType>,
628
+ TInternalType extends CustomBehaviorEventType<'custom', TType> =
629
+ CustomBehaviorEventType<'custom', TType>,
632
630
  > = {
633
631
  type: TInternalType
634
632
  } & TPayload
@@ -11,8 +11,10 @@ export interface VoidElement {
11
11
  value: Record<string, unknown>
12
12
  }
13
13
 
14
- export interface SlateTextBlock
15
- extends Omit<PortableTextTextBlock, 'children'> {
14
+ export interface SlateTextBlock extends Omit<
15
+ PortableTextTextBlock,
16
+ 'children'
17
+ > {
16
18
  children: Descendant[]
17
19
  }
18
20
 
@@ -5,10 +5,10 @@ import type {EditorSelection, EditorSelectionPoint} from '../types/editor'
5
5
  */
6
6
  export function getSelectionEndPoint<
7
7
  TEditorSelection extends NonNullable<EditorSelection> | null,
8
- TEditorSelectionPoint extends
9
- EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
10
- ? EditorSelectionPoint
11
- : null,
8
+ TEditorSelectionPoint extends EditorSelectionPoint | null =
9
+ TEditorSelection extends NonNullable<EditorSelection>
10
+ ? EditorSelectionPoint
11
+ : null,
12
12
  >(selection: TEditorSelection): TEditorSelectionPoint {
13
13
  if (!selection) {
14
14
  return null as TEditorSelectionPoint
@@ -5,10 +5,10 @@ import type {EditorSelection, EditorSelectionPoint} from '../types/editor'
5
5
  */
6
6
  export function getSelectionStartPoint<
7
7
  TEditorSelection extends NonNullable<EditorSelection> | null,
8
- TEditorSelectionPoint extends
9
- EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
10
- ? EditorSelectionPoint
11
- : null,
8
+ TEditorSelectionPoint extends EditorSelectionPoint | null =
9
+ TEditorSelection extends NonNullable<EditorSelection>
10
+ ? EditorSelectionPoint
11
+ : null,
12
12
  >(selection: TEditorSelection): TEditorSelectionPoint {
13
13
  if (!selection) {
14
14
  return null as TEditorSelectionPoint