@portabletext/editor 1.58.0 → 2.0.0-canary.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-dts/behavior.types.action.d.cts +3750 -0
- package/lib/_chunks-dts/behavior.types.action.d.ts +3750 -0
- package/lib/behaviors/index.d.cts +2 -998
- package/lib/behaviors/index.d.ts +2 -998
- package/lib/index.d.cts +2 -7634
- package/lib/index.d.ts +2 -7634
- package/lib/plugins/index.d.cts +75 -1182
- package/lib/plugins/index.d.ts +75 -1182
- package/lib/selectors/index.d.cts +138 -523
- package/lib/selectors/index.d.ts +138 -523
- package/lib/utils/index.d.cts +96 -390
- package/lib/utils/index.d.ts +96 -390
- package/package.json +12 -12
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,487 +1,193 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
PortableTextBlock,
|
|
5
|
-
PortableTextChild,
|
|
6
|
-
PortableTextTextBlock,
|
|
7
|
-
} from '@sanity/types'
|
|
8
|
-
import {PortableTextObject, PortableTextSpan} from '@sanity/types'
|
|
9
|
-
|
|
1
|
+
import { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
+
import * as _sanity_types8 from "@sanity/types";
|
|
3
|
+
import { KeyedSegment, PortableTextBlock, PortableTextChild, PortableTextSpan, PortableTextTextBlock } from "@sanity/types";
|
|
10
4
|
/**
|
|
11
5
|
* @public
|
|
12
6
|
*/
|
|
13
|
-
declare
|
|
14
|
-
fields: ReadonlyArray<FieldDefinition>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
declare type BaseDefinition = {
|
|
21
|
-
name: string
|
|
22
|
-
title?: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
declare type BlockObjectSchemaType = BaseDefinition & {
|
|
29
|
-
fields: ReadonlyArray<FieldDefinition>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @beta
|
|
34
|
-
*/
|
|
35
|
-
declare type BlockOffset = {
|
|
36
|
-
path: BlockPath
|
|
37
|
-
offset: number
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
export declare function blockOffsetsToSelection({
|
|
7
|
+
declare function blockOffsetToSpanSelectionPoint({
|
|
44
8
|
context,
|
|
45
|
-
|
|
46
|
-
|
|
9
|
+
blockOffset,
|
|
10
|
+
direction
|
|
47
11
|
}: {
|
|
48
|
-
context: Pick<EditorContext, 'schema' | 'value'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
12
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
13
|
+
blockOffset: BlockOffset;
|
|
14
|
+
direction: 'forward' | 'backward';
|
|
15
|
+
}): {
|
|
16
|
+
path: ChildPath;
|
|
17
|
+
offset: number;
|
|
18
|
+
} | undefined;
|
|
56
19
|
/**
|
|
57
20
|
* @public
|
|
58
21
|
*/
|
|
59
|
-
|
|
22
|
+
declare function spanSelectionPointToBlockOffset({
|
|
60
23
|
context,
|
|
61
|
-
|
|
24
|
+
selectionPoint
|
|
62
25
|
}: {
|
|
63
|
-
context: Pick<EditorContext, 'value'
|
|
64
|
-
|
|
65
|
-
}):
|
|
66
|
-
|
|
26
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
27
|
+
selectionPoint: EditorSelectionPoint;
|
|
28
|
+
}): BlockOffset | undefined;
|
|
67
29
|
/**
|
|
68
30
|
* @public
|
|
69
31
|
*/
|
|
70
|
-
|
|
32
|
+
declare function blockOffsetToBlockSelectionPoint({
|
|
71
33
|
context,
|
|
72
|
-
blockOffset
|
|
73
|
-
direction,
|
|
34
|
+
blockOffset
|
|
74
35
|
}: {
|
|
75
|
-
context: Pick<EditorContext, '
|
|
76
|
-
blockOffset: BlockOffset
|
|
77
|
-
|
|
78
|
-
}): EditorSelectionPoint | undefined
|
|
79
|
-
|
|
36
|
+
context: Pick<EditorContext, 'value'>;
|
|
37
|
+
blockOffset: BlockOffset;
|
|
38
|
+
}): EditorSelectionPoint | undefined;
|
|
80
39
|
/**
|
|
81
40
|
* @public
|
|
82
41
|
*/
|
|
83
|
-
|
|
42
|
+
declare function blockOffsetToSelectionPoint({
|
|
84
43
|
context,
|
|
85
44
|
blockOffset,
|
|
86
|
-
direction
|
|
45
|
+
direction
|
|
87
46
|
}: {
|
|
88
|
-
context: Pick<EditorContext, 'schema' | 'value'
|
|
89
|
-
blockOffset: BlockOffset
|
|
90
|
-
direction: 'forward' | 'backward'
|
|
91
|
-
}):
|
|
92
|
-
| {
|
|
93
|
-
path: ChildPath
|
|
94
|
-
offset: number
|
|
95
|
-
}
|
|
96
|
-
| undefined
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @public
|
|
100
|
-
*/
|
|
101
|
-
declare type BlockPath = [
|
|
102
|
-
{
|
|
103
|
-
_key: string
|
|
104
|
-
},
|
|
105
|
-
]
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @public
|
|
109
|
-
*/
|
|
110
|
-
declare type ChildPath = [
|
|
111
|
-
{
|
|
112
|
-
_key: string
|
|
113
|
-
},
|
|
114
|
-
'children',
|
|
115
|
-
{
|
|
116
|
-
_key: string
|
|
117
|
-
},
|
|
118
|
-
]
|
|
119
|
-
|
|
47
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
48
|
+
blockOffset: BlockOffset;
|
|
49
|
+
direction: 'forward' | 'backward';
|
|
50
|
+
}): EditorSelectionPoint | undefined;
|
|
120
51
|
/**
|
|
121
52
|
* @public
|
|
122
53
|
*/
|
|
123
|
-
|
|
54
|
+
declare function blockOffsetsToSelection({
|
|
124
55
|
context,
|
|
125
|
-
|
|
56
|
+
offsets,
|
|
57
|
+
backward
|
|
126
58
|
}: {
|
|
127
|
-
context: Pick<EditorContext, 'schema' | 'value'
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
deserialize: Deserializer<TMIMEType>
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
138
|
-
| {
|
|
139
|
-
type: 'serialize'
|
|
140
|
-
originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
141
|
-
}
|
|
142
|
-
| {
|
|
143
|
-
type: 'serialization.failure'
|
|
144
|
-
mimeType: TMIMEType
|
|
145
|
-
originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
146
|
-
reason: string
|
|
147
|
-
}
|
|
148
|
-
| {
|
|
149
|
-
type: 'serialization.success'
|
|
150
|
-
data: string
|
|
151
|
-
mimeType: TMIMEType
|
|
152
|
-
originEvent: 'clipboard.copy' | 'clipboard.cut' | 'drag.dragstart'
|
|
153
|
-
}
|
|
154
|
-
| {
|
|
155
|
-
type: 'deserialize'
|
|
156
|
-
data: string
|
|
157
|
-
}
|
|
158
|
-
| {
|
|
159
|
-
type: 'deserialization.failure'
|
|
160
|
-
mimeType: TMIMEType
|
|
161
|
-
reason: string
|
|
162
|
-
}
|
|
163
|
-
| {
|
|
164
|
-
type: 'deserialization.success'
|
|
165
|
-
data: Array<PortableTextBlock>
|
|
166
|
-
mimeType: TMIMEType
|
|
167
|
-
}
|
|
168
|
-
|
|
59
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
60
|
+
offsets: {
|
|
61
|
+
anchor: BlockOffset;
|
|
62
|
+
focus: BlockOffset;
|
|
63
|
+
};
|
|
64
|
+
backward?: boolean;
|
|
65
|
+
}): EditorSelection;
|
|
169
66
|
/**
|
|
170
67
|
* @public
|
|
171
68
|
*/
|
|
172
|
-
declare
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* Use `name` instead
|
|
176
|
-
*/
|
|
177
|
-
value: string
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
181
|
-
snapshot,
|
|
182
|
-
event,
|
|
69
|
+
declare function childSelectionPointToBlockOffset({
|
|
70
|
+
context,
|
|
71
|
+
selectionPoint
|
|
183
72
|
}: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
})
|
|
187
|
-
ConverterEvent<TMIMEType>,
|
|
188
|
-
'type',
|
|
189
|
-
'deserialization.success' | 'deserialization.failure'
|
|
190
|
-
>
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
declare type EditorContext = {
|
|
196
|
-
converters: Array<Converter>
|
|
197
|
-
keyGenerator: () => string
|
|
198
|
-
readOnly: boolean
|
|
199
|
-
schema: EditorSchema
|
|
200
|
-
selection: EditorSelection
|
|
201
|
-
value: Array<PortableTextBlock>
|
|
202
|
-
}
|
|
203
|
-
|
|
73
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
74
|
+
selectionPoint: EditorSelectionPoint;
|
|
75
|
+
}): BlockOffset | undefined;
|
|
204
76
|
/**
|
|
205
77
|
* @public
|
|
206
78
|
*/
|
|
207
|
-
declare
|
|
208
|
-
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
209
|
-
block: {
|
|
210
|
-
name: string
|
|
211
|
-
}
|
|
212
|
-
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
213
|
-
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
214
|
-
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
215
|
-
span: {
|
|
216
|
-
name: string
|
|
217
|
-
}
|
|
218
|
-
styles: ReadonlyArray<StyleSchemaType>
|
|
219
|
-
lists: ReadonlyArray<ListSchemaType>
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/** @public */
|
|
223
|
-
declare type EditorSelection = {
|
|
224
|
-
anchor: EditorSelectionPoint
|
|
225
|
-
focus: EditorSelectionPoint
|
|
226
|
-
backward?: boolean
|
|
227
|
-
} | null
|
|
228
|
-
|
|
229
|
-
/** @public */
|
|
230
|
-
declare type EditorSelectionPoint = {
|
|
231
|
-
path: Path
|
|
232
|
-
offset: number
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
declare type EditorSnapshot = {
|
|
239
|
-
context: EditorContext
|
|
240
|
-
blockIndexMap: Map<string, number>
|
|
241
|
-
/**
|
|
242
|
-
* @beta
|
|
243
|
-
* Subject to change
|
|
244
|
-
*/
|
|
245
|
-
decoratorState: Record<string, boolean | undefined>
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* @public
|
|
250
|
-
*/
|
|
251
|
-
declare type FieldDefinition = BaseDefinition & {
|
|
252
|
-
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @public
|
|
257
|
-
*/
|
|
258
|
-
export declare function getBlockEndPoint({
|
|
79
|
+
declare function getBlockEndPoint({
|
|
259
80
|
context,
|
|
260
|
-
block
|
|
81
|
+
block
|
|
261
82
|
}: {
|
|
262
|
-
context: Pick<EditorContext, 'schema'
|
|
83
|
+
context: Pick<EditorContext, 'schema'>;
|
|
263
84
|
block: {
|
|
264
|
-
node: PortableTextBlock
|
|
265
|
-
path: BlockPath
|
|
266
|
-
}
|
|
267
|
-
}): EditorSelectionPoint
|
|
268
|
-
|
|
85
|
+
node: PortableTextBlock;
|
|
86
|
+
path: BlockPath;
|
|
87
|
+
};
|
|
88
|
+
}): EditorSelectionPoint;
|
|
269
89
|
/**
|
|
270
90
|
* @public
|
|
271
91
|
*/
|
|
272
|
-
|
|
92
|
+
declare function getBlockStartPoint({
|
|
273
93
|
context,
|
|
274
|
-
block
|
|
94
|
+
block
|
|
275
95
|
}: {
|
|
276
|
-
context: Pick<EditorContext, 'schema'
|
|
96
|
+
context: Pick<EditorContext, 'schema'>;
|
|
277
97
|
block: {
|
|
278
|
-
node: PortableTextBlock
|
|
279
|
-
path: BlockPath
|
|
280
|
-
}
|
|
281
|
-
}): EditorSelectionPoint
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* @public
|
|
285
|
-
*/
|
|
286
|
-
export declare function getSelectionEndPoint<
|
|
287
|
-
TEditorSelection extends NonNullable<EditorSelection> | null,
|
|
288
|
-
TEditorSelectionPoint extends
|
|
289
|
-
EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
|
|
290
|
-
? EditorSelectionPoint
|
|
291
|
-
: null,
|
|
292
|
-
>(selection: TEditorSelection): TEditorSelectionPoint
|
|
293
|
-
|
|
98
|
+
node: PortableTextBlock;
|
|
99
|
+
path: BlockPath;
|
|
100
|
+
};
|
|
101
|
+
}): EditorSelectionPoint;
|
|
294
102
|
/**
|
|
295
103
|
* @public
|
|
296
104
|
*/
|
|
297
|
-
|
|
298
|
-
TEditorSelection extends NonNullable<EditorSelection> | null,
|
|
299
|
-
TEditorSelectionPoint extends
|
|
300
|
-
EditorSelectionPoint | null = TEditorSelection extends NonNullable<EditorSelection>
|
|
301
|
-
? EditorSelectionPoint
|
|
302
|
-
: null,
|
|
303
|
-
>(selection: TEditorSelection): TEditorSelectionPoint
|
|
304
|
-
|
|
105
|
+
declare function getSelectionEndPoint<TEditorSelection extends NonNullable<EditorSelection> | null, TEditorSelectionPoint extends EditorSelectionPoint | null = (TEditorSelection extends NonNullable<EditorSelection> ? EditorSelectionPoint : null)>(selection: TEditorSelection): TEditorSelectionPoint;
|
|
305
106
|
/**
|
|
306
107
|
* @public
|
|
307
108
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
109
|
+
declare function getSelectionStartPoint<TEditorSelection extends NonNullable<EditorSelection> | null, TEditorSelectionPoint extends EditorSelectionPoint | null = (TEditorSelection extends NonNullable<EditorSelection> ? EditorSelectionPoint : null)>(selection: TEditorSelection): TEditorSelectionPoint;
|
|
310
110
|
/**
|
|
311
111
|
* @public
|
|
312
112
|
*/
|
|
313
|
-
declare
|
|
314
|
-
fields: ReadonlyArray<FieldDefinition>
|
|
315
|
-
}
|
|
316
|
-
|
|
113
|
+
declare function getTextBlockText(block: PortableTextTextBlock): string;
|
|
317
114
|
/**
|
|
318
115
|
* @public
|
|
319
116
|
*/
|
|
320
|
-
|
|
321
|
-
context: Pick<EditorContext, 'schema'>,
|
|
322
|
-
block: PortableTextBlock,
|
|
323
|
-
): boolean
|
|
324
|
-
|
|
117
|
+
declare function isEmptyTextBlock(context: Pick<EditorContext, 'schema'>, block: PortableTextBlock): boolean;
|
|
325
118
|
/**
|
|
326
119
|
* @public
|
|
327
120
|
*/
|
|
328
|
-
|
|
329
|
-
a: EditorSelectionPoint,
|
|
330
|
-
b: EditorSelectionPoint,
|
|
331
|
-
): boolean
|
|
332
|
-
|
|
121
|
+
declare function isEqualSelectionPoints(a: EditorSelectionPoint, b: EditorSelectionPoint): boolean;
|
|
333
122
|
/**
|
|
334
123
|
* @public
|
|
335
124
|
*/
|
|
336
|
-
|
|
337
|
-
a: EditorSelection,
|
|
338
|
-
b: EditorSelection,
|
|
339
|
-
): boolean
|
|
340
|
-
|
|
125
|
+
declare function isEqualSelections(a: EditorSelection, b: EditorSelection): boolean;
|
|
341
126
|
/**
|
|
342
127
|
* @public
|
|
343
128
|
*/
|
|
344
|
-
|
|
345
|
-
segment: unknown,
|
|
346
|
-
): segment is KeyedSegment
|
|
347
|
-
|
|
129
|
+
declare function isKeyedSegment(segment: unknown): segment is KeyedSegment;
|
|
348
130
|
/**
|
|
349
131
|
* @public
|
|
350
132
|
*/
|
|
351
|
-
|
|
352
|
-
selection: EditorSelection,
|
|
353
|
-
): boolean
|
|
354
|
-
|
|
133
|
+
declare function isSelectionCollapsed(selection: EditorSelection): boolean;
|
|
355
134
|
/**
|
|
356
135
|
* @public
|
|
357
136
|
*/
|
|
358
|
-
|
|
359
|
-
context: Pick<EditorContext, 'schema'>,
|
|
360
|
-
child: PortableTextChild,
|
|
361
|
-
): child is PortableTextSpan
|
|
362
|
-
|
|
137
|
+
declare function isSpan(context: Pick<EditorContext, 'schema'>, child: PortableTextChild): child is PortableTextSpan;
|
|
363
138
|
/**
|
|
364
139
|
* @public
|
|
365
140
|
*/
|
|
366
|
-
|
|
367
|
-
context: Pick<EditorContext, 'schema'>,
|
|
368
|
-
block: unknown,
|
|
369
|
-
): block is PortableTextTextBlock
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* @public
|
|
373
|
-
*/
|
|
374
|
-
declare type ListSchemaType = BaseDefinition & {
|
|
375
|
-
/**
|
|
376
|
-
* @deprecated
|
|
377
|
-
* Use `name` instead
|
|
378
|
-
*/
|
|
379
|
-
value: string
|
|
380
|
-
}
|
|
381
|
-
|
|
141
|
+
declare function isTextBlock(context: Pick<EditorContext, 'schema'>, block: unknown): block is PortableTextTextBlock;
|
|
382
142
|
/**
|
|
383
143
|
* @beta
|
|
384
144
|
*/
|
|
385
|
-
|
|
145
|
+
declare function mergeTextBlocks({
|
|
386
146
|
context,
|
|
387
147
|
targetBlock,
|
|
388
|
-
incomingBlock
|
|
148
|
+
incomingBlock
|
|
389
149
|
}: {
|
|
390
|
-
context: Pick<EditorContext, 'keyGenerator' | 'schema'
|
|
391
|
-
targetBlock: PortableTextTextBlock
|
|
392
|
-
incomingBlock: PortableTextTextBlock
|
|
393
|
-
}): PortableTextTextBlock<PortableTextObject | PortableTextSpan
|
|
394
|
-
|
|
395
|
-
declare type MIMEType = `${string}/${string}`
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* @internal
|
|
399
|
-
*/
|
|
400
|
-
declare type PickFromUnion<
|
|
401
|
-
TUnion,
|
|
402
|
-
TTagKey extends keyof TUnion,
|
|
403
|
-
TPickedTags extends TUnion[TTagKey],
|
|
404
|
-
> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* @public
|
|
408
|
-
*/
|
|
409
|
-
export declare function reverseSelection<
|
|
410
|
-
TEditorSelection extends NonNullable<EditorSelection> | null,
|
|
411
|
-
>(selection: TEditorSelection): TEditorSelection
|
|
412
|
-
|
|
150
|
+
context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
|
|
151
|
+
targetBlock: PortableTextTextBlock;
|
|
152
|
+
incomingBlock: PortableTextTextBlock;
|
|
153
|
+
}): PortableTextTextBlock<_sanity_types8.PortableTextObject | _sanity_types8.PortableTextSpan>;
|
|
413
154
|
/**
|
|
414
155
|
* @public
|
|
415
156
|
*/
|
|
416
|
-
|
|
417
|
-
context,
|
|
418
|
-
selectionPoint,
|
|
419
|
-
}: {
|
|
420
|
-
context: Pick<EditorContext, 'schema' | 'value'>
|
|
421
|
-
selectionPoint: EditorSelectionPoint
|
|
422
|
-
}): BlockOffset | undefined
|
|
423
|
-
|
|
424
|
-
declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
425
|
-
snapshot,
|
|
426
|
-
event,
|
|
427
|
-
}: {
|
|
428
|
-
snapshot: EditorSnapshot
|
|
429
|
-
event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialize'>
|
|
430
|
-
}) => PickFromUnion<
|
|
431
|
-
ConverterEvent<TMIMEType>,
|
|
432
|
-
'type',
|
|
433
|
-
'serialization.success' | 'serialization.failure'
|
|
434
|
-
>
|
|
435
|
-
|
|
157
|
+
declare function reverseSelection<TEditorSelection extends NonNullable<EditorSelection> | null>(selection: TEditorSelection): TEditorSelection;
|
|
436
158
|
/**
|
|
437
159
|
* @public
|
|
438
160
|
*/
|
|
439
|
-
|
|
161
|
+
declare function selectionPointToBlockOffset({
|
|
440
162
|
context,
|
|
441
|
-
|
|
163
|
+
selectionPoint
|
|
442
164
|
}: {
|
|
443
|
-
context: Pick<EditorContext, 'schema' | '
|
|
444
|
-
|
|
445
|
-
}):
|
|
446
|
-
|
|
165
|
+
context: Pick<EditorContext, 'schema' | 'value'>;
|
|
166
|
+
selectionPoint: EditorSelectionPoint;
|
|
167
|
+
}): BlockOffset | undefined;
|
|
447
168
|
/**
|
|
448
169
|
* @public
|
|
449
170
|
*/
|
|
450
|
-
|
|
171
|
+
declare function sliceBlocks({
|
|
451
172
|
context,
|
|
452
|
-
|
|
173
|
+
blocks
|
|
453
174
|
}: {
|
|
454
|
-
context: Pick<EditorContext, 'schema' | '
|
|
455
|
-
|
|
456
|
-
}):
|
|
457
|
-
|
|
175
|
+
context: Pick<EditorContext, 'schema' | 'selection'>;
|
|
176
|
+
blocks: Array<PortableTextBlock>;
|
|
177
|
+
}): Array<PortableTextBlock>;
|
|
458
178
|
/**
|
|
459
179
|
* @beta
|
|
460
180
|
*/
|
|
461
|
-
|
|
181
|
+
declare function splitTextBlock({
|
|
462
182
|
context,
|
|
463
183
|
block,
|
|
464
|
-
point
|
|
184
|
+
point
|
|
465
185
|
}: {
|
|
466
|
-
context: Pick<EditorContext, 'schema'
|
|
467
|
-
block: PortableTextTextBlock
|
|
468
|
-
point: EditorSelectionPoint
|
|
469
|
-
}):
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
| undefined
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* @public
|
|
478
|
-
*/
|
|
479
|
-
declare type StyleSchemaType = BaseDefinition & {
|
|
480
|
-
/**
|
|
481
|
-
* @deprecated
|
|
482
|
-
* Use `name` instead
|
|
483
|
-
*/
|
|
484
|
-
value: string
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
export {}
|
|
186
|
+
context: Pick<EditorContext, 'schema'>;
|
|
187
|
+
block: PortableTextTextBlock;
|
|
188
|
+
point: EditorSelectionPoint;
|
|
189
|
+
}): {
|
|
190
|
+
before: PortableTextTextBlock;
|
|
191
|
+
after: PortableTextTextBlock;
|
|
192
|
+
} | undefined;
|
|
193
|
+
export { blockOffsetToBlockSelectionPoint, blockOffsetToSelectionPoint, blockOffsetToSpanSelectionPoint, blockOffsetsToSelection, childSelectionPointToBlockOffset, getBlockEndPoint, getBlockStartPoint, getSelectionEndPoint, getSelectionStartPoint, getTextBlockText, isEmptyTextBlock, isEqualSelectionPoints, isEqualSelections, isKeyedSegment, isSelectionCollapsed, isSpan, isTextBlock, mergeTextBlocks, reverseSelection, selectionPointToBlockOffset, sliceBlocks, spanSelectionPointToBlockOffset, splitTextBlock };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-canary.0",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"slate-react": "0.117.3",
|
|
81
81
|
"use-effect-event": "^1.0.2",
|
|
82
82
|
"xstate": "^5.20.1",
|
|
83
|
-
"@portabletext/block-tools": "
|
|
84
|
-
"@portabletext/keyboard-shortcuts": "
|
|
85
|
-
"@portabletext/patches": "
|
|
83
|
+
"@portabletext/block-tools": "2.0.0-canary.0",
|
|
84
|
+
"@portabletext/keyboard-shortcuts": "2.0.0-canary.0",
|
|
85
|
+
"@portabletext/patches": "2.0.0-canary.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@portabletext/toolkit": "^2.0.17",
|
|
89
89
|
"@sanity/diff-match-patch": "^3.2.0",
|
|
90
|
-
"@sanity/pkg-utils": "^7.9.
|
|
91
|
-
"@sanity/schema": "^
|
|
92
|
-
"@sanity/types": "^
|
|
90
|
+
"@sanity/pkg-utils": "^7.9.6",
|
|
91
|
+
"@sanity/schema": "^4.0.1",
|
|
92
|
+
"@sanity/types": "^4.0.1",
|
|
93
93
|
"@testing-library/react": "^16.3.0",
|
|
94
94
|
"@types/debug": "^4.1.12",
|
|
95
95
|
"@types/lodash": "^4.17.16",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
104
104
|
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
105
105
|
"eslint": "8.57.1",
|
|
106
|
-
"eslint-plugin-react-hooks": "0.0.0-experimental-
|
|
106
|
+
"eslint-plugin-react-hooks": "0.0.0-experimental-97cdd5d3-20250710",
|
|
107
107
|
"jsdom": "^26.0.0",
|
|
108
108
|
"react": "^19.1.0",
|
|
109
109
|
"react-dom": "^19.1.0",
|
|
@@ -115,13 +115,13 @@
|
|
|
115
115
|
"racejar": "1.2.10"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
|
-
"@sanity/schema": "^
|
|
119
|
-
"@sanity/types": "^
|
|
120
|
-
"react": "^
|
|
118
|
+
"@sanity/schema": "^4.0.1",
|
|
119
|
+
"@sanity/types": "^4.0.1",
|
|
120
|
+
"react": "^18.3 || ^19",
|
|
121
121
|
"rxjs": "^7.8.2"
|
|
122
122
|
},
|
|
123
123
|
"engines": {
|
|
124
|
-
"node": ">=
|
|
124
|
+
"node": ">=20.19"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|