@portabletext/editor 1.55.4 → 1.55.6
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-text-block.cjs +67 -0
- package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -0
- package/lib/_chunks-es/util.slice-text-block.js +69 -0
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -0
- package/lib/behaviors/index.d.cts +72 -52
- package/lib/behaviors/index.d.ts +72 -52
- package/lib/index.cjs +15 -15
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +117 -69
- package/lib/index.d.ts +117 -69
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +71 -51
- package/lib/plugins/index.d.ts +71 -51
- package/lib/selectors/index.d.cts +68 -51
- package/lib/selectors/index.d.ts +68 -51
- package/lib/utils/index.cjs +12 -13
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +68 -51
- package/lib/utils/index.d.ts +68 -51
- package/lib/utils/index.js +14 -15
- package/lib/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/src/behaviors/behavior.abstract.split.ts +8 -9
- package/src/behaviors/behavior.types.event.ts +3 -0
- package/src/behaviors/index.ts +2 -1
- package/src/converters/converter.portable-text.deserialize.test.ts +3 -5
- package/src/converters/converter.text-html.deserialize.test.ts +2 -2
- package/src/converters/converter.text-html.serialize.test.ts +2 -2
- package/src/converters/converter.text-plain.test.ts +3 -5
- package/src/editor/editor-schema-definition.ts +106 -0
- package/src/editor/editor-schema.ts +65 -107
- package/src/editor.ts +1 -1
- package/src/index.ts +16 -2
- package/src/internal-utils/apply-operation-to-portable-text.test.ts +2 -1
- package/src/internal-utils/build-index-maps.test.ts +2 -1
- package/src/internal-utils/create-test-snapshot.ts +2 -1
- package/src/internal-utils/drag-selection.test.ts +2 -1
- package/src/internal-utils/parse-blocks.test.ts +2 -1
- package/src/internal-utils/selection-text.ts +2 -1
- package/src/internal-utils/terse-pt.test.ts +2 -1
- package/src/internal-utils/test-editor.tsx +4 -1
- package/src/plugins/plugin.markdown.test.tsx +1 -1
- package/src/selectors/selector.get-selection-text.test.ts +2 -1
- package/src/selectors/selector.get-trimmed-selection.test.ts +2 -1
- package/src/utils/util.block-offset.test.ts +2 -1
- package/src/utils/util.slice-blocks.test.ts +2 -1
- package/src/utils/util.slice-text-block.test.ts +163 -0
- package/src/utils/util.slice-text-block.ts +89 -0
- package/src/utils/util.split-text-block.ts +7 -16
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +0 -23
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +0 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js +0 -25
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +0 -1
package/lib/plugins/index.d.cts
CHANGED
|
@@ -221,6 +221,13 @@ declare type AnnotationPath = [
|
|
|
221
221
|
},
|
|
222
222
|
]
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
declare type AnnotationSchemaType = BaseDefinition & {
|
|
228
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
229
|
+
}
|
|
230
|
+
|
|
224
231
|
/**
|
|
225
232
|
* @public
|
|
226
233
|
*/
|
|
@@ -323,6 +330,13 @@ export declare function BehaviorPlugin(props: {
|
|
|
323
330
|
behaviors: Array<Behavior>
|
|
324
331
|
}): null
|
|
325
332
|
|
|
333
|
+
/**
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
336
|
+
declare type BlockObjectSchemaType = BaseDefinition & {
|
|
337
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
338
|
+
}
|
|
339
|
+
|
|
326
340
|
/**
|
|
327
341
|
* @beta
|
|
328
342
|
*/
|
|
@@ -442,6 +456,17 @@ declare type CustomBehaviorEventType<
|
|
|
442
456
|
TType extends string = '',
|
|
443
457
|
> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
|
|
444
458
|
|
|
459
|
+
/**
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
declare type DecoratorSchemaType = BaseDefinition & {
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated
|
|
465
|
+
* Use `name` instead
|
|
466
|
+
*/
|
|
467
|
+
value: string
|
|
468
|
+
}
|
|
469
|
+
|
|
445
470
|
/**
|
|
446
471
|
* @beta
|
|
447
472
|
* @deprecated Install the plugin from `@portabletext/plugin-character-pair-decorator`
|
|
@@ -636,63 +661,18 @@ export declare const EditorRefPlugin: React_2.ForwardRefExoticComponent<
|
|
|
636
661
|
* @public
|
|
637
662
|
*/
|
|
638
663
|
declare type EditorSchema = {
|
|
639
|
-
annotations: ReadonlyArray<
|
|
640
|
-
BaseDefinition & {
|
|
641
|
-
fields: ReadonlyArray<{
|
|
642
|
-
name: string
|
|
643
|
-
type: string
|
|
644
|
-
}>
|
|
645
|
-
}
|
|
646
|
-
>
|
|
664
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
647
665
|
block: {
|
|
648
666
|
name: string
|
|
649
667
|
}
|
|
650
|
-
blockObjects: ReadonlyArray<
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
name: string
|
|
654
|
-
type: string
|
|
655
|
-
}>
|
|
656
|
-
}
|
|
657
|
-
>
|
|
658
|
-
decorators: ReadonlyArray<
|
|
659
|
-
BaseDefinition & {
|
|
660
|
-
/**
|
|
661
|
-
* @deprecated
|
|
662
|
-
* Use `name` instead
|
|
663
|
-
*/
|
|
664
|
-
value: string
|
|
665
|
-
}
|
|
666
|
-
>
|
|
667
|
-
inlineObjects: ReadonlyArray<
|
|
668
|
-
BaseDefinition & {
|
|
669
|
-
fields: ReadonlyArray<{
|
|
670
|
-
name: string
|
|
671
|
-
type: string
|
|
672
|
-
}>
|
|
673
|
-
}
|
|
674
|
-
>
|
|
668
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
669
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
670
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
675
671
|
span: {
|
|
676
672
|
name: string
|
|
677
673
|
}
|
|
678
|
-
styles: ReadonlyArray<
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* @deprecated
|
|
682
|
-
* Use `name` instead
|
|
683
|
-
*/
|
|
684
|
-
value: string
|
|
685
|
-
}
|
|
686
|
-
>
|
|
687
|
-
lists: ReadonlyArray<
|
|
688
|
-
BaseDefinition & {
|
|
689
|
-
/**
|
|
690
|
-
* @deprecated
|
|
691
|
-
* Use `name` instead
|
|
692
|
-
*/
|
|
693
|
-
value: string
|
|
694
|
-
}
|
|
695
|
-
>
|
|
674
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
675
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
696
676
|
}
|
|
697
677
|
|
|
698
678
|
/** @public */
|
|
@@ -843,6 +823,21 @@ declare type ExternalEditorEvent =
|
|
|
843
823
|
declare type ExtractNamespace<TType extends string> =
|
|
844
824
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
845
825
|
|
|
826
|
+
/**
|
|
827
|
+
* @public
|
|
828
|
+
*/
|
|
829
|
+
declare type FieldDefinition = {
|
|
830
|
+
name: string
|
|
831
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* @public
|
|
836
|
+
*/
|
|
837
|
+
declare type InlineObjectSchemaType = BaseDefinition & {
|
|
838
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
839
|
+
}
|
|
840
|
+
|
|
846
841
|
/**
|
|
847
842
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
848
843
|
*
|
|
@@ -861,6 +856,9 @@ declare type InputBehaviorEvent = {
|
|
|
861
856
|
}
|
|
862
857
|
}
|
|
863
858
|
|
|
859
|
+
/**
|
|
860
|
+
* @beta
|
|
861
|
+
*/
|
|
864
862
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
865
863
|
|
|
866
864
|
/**
|
|
@@ -902,6 +900,17 @@ declare type KeyboardBehaviorEvent =
|
|
|
902
900
|
>
|
|
903
901
|
}
|
|
904
902
|
|
|
903
|
+
/**
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
declare type ListSchemaType = BaseDefinition & {
|
|
907
|
+
/**
|
|
908
|
+
* @deprecated
|
|
909
|
+
* Use `name` instead
|
|
910
|
+
*/
|
|
911
|
+
value: string
|
|
912
|
+
}
|
|
913
|
+
|
|
905
914
|
declare type MarkdownBehaviorsConfig = {
|
|
906
915
|
horizontalRuleObject?: (context: {schema: EditorSchema}) =>
|
|
907
916
|
| {
|
|
@@ -1128,6 +1137,17 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
1128
1137
|
|
|
1129
1138
|
declare type StrictExtract<T, U extends T> = U
|
|
1130
1139
|
|
|
1140
|
+
/**
|
|
1141
|
+
* @public
|
|
1142
|
+
*/
|
|
1143
|
+
declare type StyleSchemaType = BaseDefinition & {
|
|
1144
|
+
/**
|
|
1145
|
+
* @deprecated
|
|
1146
|
+
* Use `name` instead
|
|
1147
|
+
*/
|
|
1148
|
+
value: string
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1131
1151
|
/**
|
|
1132
1152
|
* @beta
|
|
1133
1153
|
*/
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -221,6 +221,13 @@ declare type AnnotationPath = [
|
|
|
221
221
|
},
|
|
222
222
|
]
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
declare type AnnotationSchemaType = BaseDefinition & {
|
|
228
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
229
|
+
}
|
|
230
|
+
|
|
224
231
|
/**
|
|
225
232
|
* @public
|
|
226
233
|
*/
|
|
@@ -323,6 +330,13 @@ export declare function BehaviorPlugin(props: {
|
|
|
323
330
|
behaviors: Array<Behavior>
|
|
324
331
|
}): null
|
|
325
332
|
|
|
333
|
+
/**
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
336
|
+
declare type BlockObjectSchemaType = BaseDefinition & {
|
|
337
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
338
|
+
}
|
|
339
|
+
|
|
326
340
|
/**
|
|
327
341
|
* @beta
|
|
328
342
|
*/
|
|
@@ -442,6 +456,17 @@ declare type CustomBehaviorEventType<
|
|
|
442
456
|
TType extends string = '',
|
|
443
457
|
> = TType extends '' ? `${TNamespace}` : `${TNamespace}.${TType}`
|
|
444
458
|
|
|
459
|
+
/**
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
declare type DecoratorSchemaType = BaseDefinition & {
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated
|
|
465
|
+
* Use `name` instead
|
|
466
|
+
*/
|
|
467
|
+
value: string
|
|
468
|
+
}
|
|
469
|
+
|
|
445
470
|
/**
|
|
446
471
|
* @beta
|
|
447
472
|
* @deprecated Install the plugin from `@portabletext/plugin-character-pair-decorator`
|
|
@@ -636,63 +661,18 @@ export declare const EditorRefPlugin: React_2.ForwardRefExoticComponent<
|
|
|
636
661
|
* @public
|
|
637
662
|
*/
|
|
638
663
|
declare type EditorSchema = {
|
|
639
|
-
annotations: ReadonlyArray<
|
|
640
|
-
BaseDefinition & {
|
|
641
|
-
fields: ReadonlyArray<{
|
|
642
|
-
name: string
|
|
643
|
-
type: string
|
|
644
|
-
}>
|
|
645
|
-
}
|
|
646
|
-
>
|
|
664
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
647
665
|
block: {
|
|
648
666
|
name: string
|
|
649
667
|
}
|
|
650
|
-
blockObjects: ReadonlyArray<
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
name: string
|
|
654
|
-
type: string
|
|
655
|
-
}>
|
|
656
|
-
}
|
|
657
|
-
>
|
|
658
|
-
decorators: ReadonlyArray<
|
|
659
|
-
BaseDefinition & {
|
|
660
|
-
/**
|
|
661
|
-
* @deprecated
|
|
662
|
-
* Use `name` instead
|
|
663
|
-
*/
|
|
664
|
-
value: string
|
|
665
|
-
}
|
|
666
|
-
>
|
|
667
|
-
inlineObjects: ReadonlyArray<
|
|
668
|
-
BaseDefinition & {
|
|
669
|
-
fields: ReadonlyArray<{
|
|
670
|
-
name: string
|
|
671
|
-
type: string
|
|
672
|
-
}>
|
|
673
|
-
}
|
|
674
|
-
>
|
|
668
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
669
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
670
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
675
671
|
span: {
|
|
676
672
|
name: string
|
|
677
673
|
}
|
|
678
|
-
styles: ReadonlyArray<
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* @deprecated
|
|
682
|
-
* Use `name` instead
|
|
683
|
-
*/
|
|
684
|
-
value: string
|
|
685
|
-
}
|
|
686
|
-
>
|
|
687
|
-
lists: ReadonlyArray<
|
|
688
|
-
BaseDefinition & {
|
|
689
|
-
/**
|
|
690
|
-
* @deprecated
|
|
691
|
-
* Use `name` instead
|
|
692
|
-
*/
|
|
693
|
-
value: string
|
|
694
|
-
}
|
|
695
|
-
>
|
|
674
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
675
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
696
676
|
}
|
|
697
677
|
|
|
698
678
|
/** @public */
|
|
@@ -843,6 +823,21 @@ declare type ExternalEditorEvent =
|
|
|
843
823
|
declare type ExtractNamespace<TType extends string> =
|
|
844
824
|
TType extends `${infer Namespace}.${string}` ? Namespace : TType
|
|
845
825
|
|
|
826
|
+
/**
|
|
827
|
+
* @public
|
|
828
|
+
*/
|
|
829
|
+
declare type FieldDefinition = {
|
|
830
|
+
name: string
|
|
831
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* @public
|
|
836
|
+
*/
|
|
837
|
+
declare type InlineObjectSchemaType = BaseDefinition & {
|
|
838
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
839
|
+
}
|
|
840
|
+
|
|
846
841
|
/**
|
|
847
842
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
848
843
|
*
|
|
@@ -861,6 +856,9 @@ declare type InputBehaviorEvent = {
|
|
|
861
856
|
}
|
|
862
857
|
}
|
|
863
858
|
|
|
859
|
+
/**
|
|
860
|
+
* @beta
|
|
861
|
+
*/
|
|
864
862
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
865
863
|
|
|
866
864
|
/**
|
|
@@ -902,6 +900,17 @@ declare type KeyboardBehaviorEvent =
|
|
|
902
900
|
>
|
|
903
901
|
}
|
|
904
902
|
|
|
903
|
+
/**
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
declare type ListSchemaType = BaseDefinition & {
|
|
907
|
+
/**
|
|
908
|
+
* @deprecated
|
|
909
|
+
* Use `name` instead
|
|
910
|
+
*/
|
|
911
|
+
value: string
|
|
912
|
+
}
|
|
913
|
+
|
|
905
914
|
declare type MarkdownBehaviorsConfig = {
|
|
906
915
|
horizontalRuleObject?: (context: {schema: EditorSchema}) =>
|
|
907
916
|
| {
|
|
@@ -1128,6 +1137,17 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
1128
1137
|
|
|
1129
1138
|
declare type StrictExtract<T, U extends T> = U
|
|
1130
1139
|
|
|
1140
|
+
/**
|
|
1141
|
+
* @public
|
|
1142
|
+
*/
|
|
1143
|
+
declare type StyleSchemaType = BaseDefinition & {
|
|
1144
|
+
/**
|
|
1145
|
+
* @deprecated
|
|
1146
|
+
* Use `name` instead
|
|
1147
|
+
*/
|
|
1148
|
+
value: string
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1131
1151
|
/**
|
|
1132
1152
|
* @beta
|
|
1133
1153
|
*/
|
|
@@ -6,6 +6,13 @@ import type {
|
|
|
6
6
|
} from '@sanity/types'
|
|
7
7
|
import {PortableTextObject, PortableTextSpan} from '@sanity/types'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
declare type AnnotationSchemaType = BaseDefinition & {
|
|
13
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* @public
|
|
11
18
|
*/
|
|
@@ -14,6 +21,13 @@ declare type BaseDefinition = {
|
|
|
14
21
|
title?: string
|
|
15
22
|
}
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare type BlockObjectSchemaType = BaseDefinition & {
|
|
28
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
/**
|
|
18
32
|
* @beta
|
|
19
33
|
*/
|
|
@@ -82,6 +96,17 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
|
82
96
|
mimeType: TMIMEType
|
|
83
97
|
}
|
|
84
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
declare type DecoratorSchemaType = BaseDefinition & {
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated
|
|
105
|
+
* Use `name` instead
|
|
106
|
+
*/
|
|
107
|
+
value: string
|
|
108
|
+
}
|
|
109
|
+
|
|
85
110
|
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
86
111
|
snapshot,
|
|
87
112
|
event,
|
|
@@ -110,63 +135,18 @@ declare type EditorContext = {
|
|
|
110
135
|
* @public
|
|
111
136
|
*/
|
|
112
137
|
declare type EditorSchema = {
|
|
113
|
-
annotations: ReadonlyArray<
|
|
114
|
-
BaseDefinition & {
|
|
115
|
-
fields: ReadonlyArray<{
|
|
116
|
-
name: string
|
|
117
|
-
type: string
|
|
118
|
-
}>
|
|
119
|
-
}
|
|
120
|
-
>
|
|
138
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
121
139
|
block: {
|
|
122
140
|
name: string
|
|
123
141
|
}
|
|
124
|
-
blockObjects: ReadonlyArray<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
name: string
|
|
128
|
-
type: string
|
|
129
|
-
}>
|
|
130
|
-
}
|
|
131
|
-
>
|
|
132
|
-
decorators: ReadonlyArray<
|
|
133
|
-
BaseDefinition & {
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated
|
|
136
|
-
* Use `name` instead
|
|
137
|
-
*/
|
|
138
|
-
value: string
|
|
139
|
-
}
|
|
140
|
-
>
|
|
141
|
-
inlineObjects: ReadonlyArray<
|
|
142
|
-
BaseDefinition & {
|
|
143
|
-
fields: ReadonlyArray<{
|
|
144
|
-
name: string
|
|
145
|
-
type: string
|
|
146
|
-
}>
|
|
147
|
-
}
|
|
148
|
-
>
|
|
142
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
143
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
144
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
149
145
|
span: {
|
|
150
146
|
name: string
|
|
151
147
|
}
|
|
152
|
-
styles: ReadonlyArray<
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @deprecated
|
|
156
|
-
* Use `name` instead
|
|
157
|
-
*/
|
|
158
|
-
value: string
|
|
159
|
-
}
|
|
160
|
-
>
|
|
161
|
-
lists: ReadonlyArray<
|
|
162
|
-
BaseDefinition & {
|
|
163
|
-
/**
|
|
164
|
-
* @deprecated
|
|
165
|
-
* Use `name` instead
|
|
166
|
-
*/
|
|
167
|
-
value: string
|
|
168
|
-
}
|
|
169
|
-
>
|
|
148
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
149
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
170
150
|
}
|
|
171
151
|
|
|
172
152
|
/** @public */
|
|
@@ -203,6 +183,14 @@ declare type EditorSnapshot = {
|
|
|
203
183
|
blockIndexMap: Map<string, number>
|
|
204
184
|
}
|
|
205
185
|
|
|
186
|
+
/**
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
declare type FieldDefinition = {
|
|
190
|
+
name: string
|
|
191
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
192
|
+
}
|
|
193
|
+
|
|
206
194
|
/**
|
|
207
195
|
* @public
|
|
208
196
|
*/
|
|
@@ -544,6 +532,13 @@ export declare const getTrimmedSelection: EditorSelector<EditorSelection>
|
|
|
544
532
|
*/
|
|
545
533
|
export declare const getValue: EditorSelector<Array<PortableTextBlock>>
|
|
546
534
|
|
|
535
|
+
/**
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
538
|
+
declare type InlineObjectSchemaType = BaseDefinition & {
|
|
539
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
540
|
+
}
|
|
541
|
+
|
|
547
542
|
/**
|
|
548
543
|
* @public
|
|
549
544
|
*/
|
|
@@ -622,6 +617,17 @@ export declare const isSelectionCollapsed: EditorSelector<boolean>
|
|
|
622
617
|
*/
|
|
623
618
|
export declare const isSelectionExpanded: EditorSelector<boolean>
|
|
624
619
|
|
|
620
|
+
/**
|
|
621
|
+
* @public
|
|
622
|
+
*/
|
|
623
|
+
declare type ListSchemaType = BaseDefinition & {
|
|
624
|
+
/**
|
|
625
|
+
* @deprecated
|
|
626
|
+
* Use `name` instead
|
|
627
|
+
*/
|
|
628
|
+
value: string
|
|
629
|
+
}
|
|
630
|
+
|
|
625
631
|
declare type MIMEType = `${string}/${string}`
|
|
626
632
|
|
|
627
633
|
/**
|
|
@@ -645,4 +651,15 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
645
651
|
'serialization.success' | 'serialization.failure'
|
|
646
652
|
>
|
|
647
653
|
|
|
654
|
+
/**
|
|
655
|
+
* @public
|
|
656
|
+
*/
|
|
657
|
+
declare type StyleSchemaType = BaseDefinition & {
|
|
658
|
+
/**
|
|
659
|
+
* @deprecated
|
|
660
|
+
* Use `name` instead
|
|
661
|
+
*/
|
|
662
|
+
value: string
|
|
663
|
+
}
|
|
664
|
+
|
|
648
665
|
export {}
|
package/lib/selectors/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ import type {
|
|
|
6
6
|
} from '@sanity/types'
|
|
7
7
|
import {PortableTextObject, PortableTextSpan} from '@sanity/types'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
declare type AnnotationSchemaType = BaseDefinition & {
|
|
13
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* @public
|
|
11
18
|
*/
|
|
@@ -14,6 +21,13 @@ declare type BaseDefinition = {
|
|
|
14
21
|
title?: string
|
|
15
22
|
}
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
declare type BlockObjectSchemaType = BaseDefinition & {
|
|
28
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
/**
|
|
18
32
|
* @beta
|
|
19
33
|
*/
|
|
@@ -82,6 +96,17 @@ declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
|
82
96
|
mimeType: TMIMEType
|
|
83
97
|
}
|
|
84
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
declare type DecoratorSchemaType = BaseDefinition & {
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated
|
|
105
|
+
* Use `name` instead
|
|
106
|
+
*/
|
|
107
|
+
value: string
|
|
108
|
+
}
|
|
109
|
+
|
|
85
110
|
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
86
111
|
snapshot,
|
|
87
112
|
event,
|
|
@@ -110,63 +135,18 @@ declare type EditorContext = {
|
|
|
110
135
|
* @public
|
|
111
136
|
*/
|
|
112
137
|
declare type EditorSchema = {
|
|
113
|
-
annotations: ReadonlyArray<
|
|
114
|
-
BaseDefinition & {
|
|
115
|
-
fields: ReadonlyArray<{
|
|
116
|
-
name: string
|
|
117
|
-
type: string
|
|
118
|
-
}>
|
|
119
|
-
}
|
|
120
|
-
>
|
|
138
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
121
139
|
block: {
|
|
122
140
|
name: string
|
|
123
141
|
}
|
|
124
|
-
blockObjects: ReadonlyArray<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
name: string
|
|
128
|
-
type: string
|
|
129
|
-
}>
|
|
130
|
-
}
|
|
131
|
-
>
|
|
132
|
-
decorators: ReadonlyArray<
|
|
133
|
-
BaseDefinition & {
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated
|
|
136
|
-
* Use `name` instead
|
|
137
|
-
*/
|
|
138
|
-
value: string
|
|
139
|
-
}
|
|
140
|
-
>
|
|
141
|
-
inlineObjects: ReadonlyArray<
|
|
142
|
-
BaseDefinition & {
|
|
143
|
-
fields: ReadonlyArray<{
|
|
144
|
-
name: string
|
|
145
|
-
type: string
|
|
146
|
-
}>
|
|
147
|
-
}
|
|
148
|
-
>
|
|
142
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
143
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
144
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
149
145
|
span: {
|
|
150
146
|
name: string
|
|
151
147
|
}
|
|
152
|
-
styles: ReadonlyArray<
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @deprecated
|
|
156
|
-
* Use `name` instead
|
|
157
|
-
*/
|
|
158
|
-
value: string
|
|
159
|
-
}
|
|
160
|
-
>
|
|
161
|
-
lists: ReadonlyArray<
|
|
162
|
-
BaseDefinition & {
|
|
163
|
-
/**
|
|
164
|
-
* @deprecated
|
|
165
|
-
* Use `name` instead
|
|
166
|
-
*/
|
|
167
|
-
value: string
|
|
168
|
-
}
|
|
169
|
-
>
|
|
148
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
149
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
170
150
|
}
|
|
171
151
|
|
|
172
152
|
/** @public */
|
|
@@ -203,6 +183,14 @@ declare type EditorSnapshot = {
|
|
|
203
183
|
blockIndexMap: Map<string, number>
|
|
204
184
|
}
|
|
205
185
|
|
|
186
|
+
/**
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
declare type FieldDefinition = {
|
|
190
|
+
name: string
|
|
191
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
192
|
+
}
|
|
193
|
+
|
|
206
194
|
/**
|
|
207
195
|
* @public
|
|
208
196
|
*/
|
|
@@ -544,6 +532,13 @@ export declare const getTrimmedSelection: EditorSelector<EditorSelection>
|
|
|
544
532
|
*/
|
|
545
533
|
export declare const getValue: EditorSelector<Array<PortableTextBlock>>
|
|
546
534
|
|
|
535
|
+
/**
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
538
|
+
declare type InlineObjectSchemaType = BaseDefinition & {
|
|
539
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
540
|
+
}
|
|
541
|
+
|
|
547
542
|
/**
|
|
548
543
|
* @public
|
|
549
544
|
*/
|
|
@@ -622,6 +617,17 @@ export declare const isSelectionCollapsed: EditorSelector<boolean>
|
|
|
622
617
|
*/
|
|
623
618
|
export declare const isSelectionExpanded: EditorSelector<boolean>
|
|
624
619
|
|
|
620
|
+
/**
|
|
621
|
+
* @public
|
|
622
|
+
*/
|
|
623
|
+
declare type ListSchemaType = BaseDefinition & {
|
|
624
|
+
/**
|
|
625
|
+
* @deprecated
|
|
626
|
+
* Use `name` instead
|
|
627
|
+
*/
|
|
628
|
+
value: string
|
|
629
|
+
}
|
|
630
|
+
|
|
625
631
|
declare type MIMEType = `${string}/${string}`
|
|
626
632
|
|
|
627
633
|
/**
|
|
@@ -645,4 +651,15 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
|
645
651
|
'serialization.success' | 'serialization.failure'
|
|
646
652
|
>
|
|
647
653
|
|
|
654
|
+
/**
|
|
655
|
+
* @public
|
|
656
|
+
*/
|
|
657
|
+
declare type StyleSchemaType = BaseDefinition & {
|
|
658
|
+
/**
|
|
659
|
+
* @deprecated
|
|
660
|
+
* Use `name` instead
|
|
661
|
+
*/
|
|
662
|
+
value: string
|
|
663
|
+
}
|
|
664
|
+
|
|
648
665
|
export {}
|