@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/index.d.cts
CHANGED
|
@@ -283,6 +283,15 @@ export declare type AddedAnnotationPaths = {
|
|
|
283
283
|
spanPath: Path
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
/**
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
export declare type AnnotationDefinition<
|
|
290
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
291
|
+
> = TBaseDefinition & {
|
|
292
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
293
|
+
}
|
|
294
|
+
|
|
286
295
|
/**
|
|
287
296
|
* @public
|
|
288
297
|
*/
|
|
@@ -296,6 +305,13 @@ export declare type AnnotationPath = [
|
|
|
296
305
|
},
|
|
297
306
|
]
|
|
298
307
|
|
|
308
|
+
/**
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
export declare type AnnotationSchemaType = BaseDefinition & {
|
|
312
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
/**
|
|
300
316
|
* @public
|
|
301
317
|
*/
|
|
@@ -450,6 +466,22 @@ export declare interface BlockListItemRenderProps {
|
|
|
450
466
|
value: string
|
|
451
467
|
}
|
|
452
468
|
|
|
469
|
+
/**
|
|
470
|
+
* @public
|
|
471
|
+
*/
|
|
472
|
+
export declare type BlockObjectDefinition<
|
|
473
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
474
|
+
> = TBaseDefinition & {
|
|
475
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* @public
|
|
480
|
+
*/
|
|
481
|
+
export declare type BlockObjectSchemaType = BaseDefinition & {
|
|
482
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
483
|
+
}
|
|
484
|
+
|
|
453
485
|
/**
|
|
454
486
|
* @beta
|
|
455
487
|
*/
|
|
@@ -620,6 +652,24 @@ declare type DecoratedRange = BaseRange & {
|
|
|
620
652
|
rangeDecoration: RangeDecoration
|
|
621
653
|
}
|
|
622
654
|
|
|
655
|
+
/**
|
|
656
|
+
* @public
|
|
657
|
+
*/
|
|
658
|
+
export declare type DecoratorDefinition<
|
|
659
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
660
|
+
> = TBaseDefinition
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
export declare type DecoratorSchemaType = BaseDefinition & {
|
|
666
|
+
/**
|
|
667
|
+
* @deprecated
|
|
668
|
+
* Use `name` instead
|
|
669
|
+
*/
|
|
670
|
+
value: string
|
|
671
|
+
}
|
|
672
|
+
|
|
623
673
|
/**
|
|
624
674
|
* @public
|
|
625
675
|
* A helper wrapper that adds editor support, such as autocomplete and type checking, for a schema definition.
|
|
@@ -3074,63 +3124,18 @@ export declare type EditorProviderProps = {
|
|
|
3074
3124
|
* @public
|
|
3075
3125
|
*/
|
|
3076
3126
|
export declare type EditorSchema = {
|
|
3077
|
-
annotations: ReadonlyArray<
|
|
3078
|
-
BaseDefinition & {
|
|
3079
|
-
fields: ReadonlyArray<{
|
|
3080
|
-
name: string
|
|
3081
|
-
type: string
|
|
3082
|
-
}>
|
|
3083
|
-
}
|
|
3084
|
-
>
|
|
3127
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
3085
3128
|
block: {
|
|
3086
3129
|
name: string
|
|
3087
3130
|
}
|
|
3088
|
-
blockObjects: ReadonlyArray<
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
name: string
|
|
3092
|
-
type: string
|
|
3093
|
-
}>
|
|
3094
|
-
}
|
|
3095
|
-
>
|
|
3096
|
-
decorators: ReadonlyArray<
|
|
3097
|
-
BaseDefinition & {
|
|
3098
|
-
/**
|
|
3099
|
-
* @deprecated
|
|
3100
|
-
* Use `name` instead
|
|
3101
|
-
*/
|
|
3102
|
-
value: string
|
|
3103
|
-
}
|
|
3104
|
-
>
|
|
3105
|
-
inlineObjects: ReadonlyArray<
|
|
3106
|
-
BaseDefinition & {
|
|
3107
|
-
fields: ReadonlyArray<{
|
|
3108
|
-
name: string
|
|
3109
|
-
type: string
|
|
3110
|
-
}>
|
|
3111
|
-
}
|
|
3112
|
-
>
|
|
3131
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
3132
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
3133
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
3113
3134
|
span: {
|
|
3114
3135
|
name: string
|
|
3115
3136
|
}
|
|
3116
|
-
styles: ReadonlyArray<
|
|
3117
|
-
|
|
3118
|
-
/**
|
|
3119
|
-
* @deprecated
|
|
3120
|
-
* Use `name` instead
|
|
3121
|
-
*/
|
|
3122
|
-
value: string
|
|
3123
|
-
}
|
|
3124
|
-
>
|
|
3125
|
-
lists: ReadonlyArray<
|
|
3126
|
-
BaseDefinition & {
|
|
3127
|
-
/**
|
|
3128
|
-
* @deprecated
|
|
3129
|
-
* Use `name` instead
|
|
3130
|
-
*/
|
|
3131
|
-
value: string
|
|
3132
|
-
}
|
|
3133
|
-
>
|
|
3137
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
3138
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
3134
3139
|
}
|
|
3135
3140
|
|
|
3136
3141
|
/** @public */
|
|
@@ -3285,6 +3290,22 @@ export declare type HotkeyOptions = {
|
|
|
3285
3290
|
>
|
|
3286
3291
|
}
|
|
3287
3292
|
|
|
3293
|
+
/**
|
|
3294
|
+
* @public
|
|
3295
|
+
*/
|
|
3296
|
+
export declare type InlineObjectDefinition<
|
|
3297
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
3298
|
+
> = TBaseDefinition & {
|
|
3299
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
/**
|
|
3303
|
+
* @public
|
|
3304
|
+
*/
|
|
3305
|
+
export declare type InlineObjectSchemaType = BaseDefinition & {
|
|
3306
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3288
3309
|
/**
|
|
3289
3310
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
3290
3311
|
*
|
|
@@ -3303,6 +3324,9 @@ declare type InputBehaviorEvent = {
|
|
|
3303
3324
|
}
|
|
3304
3325
|
}
|
|
3305
3326
|
|
|
3327
|
+
/**
|
|
3328
|
+
* @beta
|
|
3329
|
+
*/
|
|
3306
3330
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
3307
3331
|
|
|
3308
3332
|
declare type InternalEditor = Editor & {
|
|
@@ -3371,6 +3395,24 @@ declare type KeyboardBehaviorEvent =
|
|
|
3371
3395
|
*/
|
|
3372
3396
|
export declare const keyGenerator: () => string
|
|
3373
3397
|
|
|
3398
|
+
/**
|
|
3399
|
+
* @public
|
|
3400
|
+
*/
|
|
3401
|
+
export declare type ListDefinition<
|
|
3402
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
3403
|
+
> = TBaseDefinition
|
|
3404
|
+
|
|
3405
|
+
/**
|
|
3406
|
+
* @public
|
|
3407
|
+
*/
|
|
3408
|
+
export declare type ListSchemaType = BaseDefinition & {
|
|
3409
|
+
/**
|
|
3410
|
+
* @deprecated
|
|
3411
|
+
* Use `name` instead
|
|
3412
|
+
*/
|
|
3413
|
+
value: string
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3374
3416
|
/**
|
|
3375
3417
|
* The editor is currently loading something
|
|
3376
3418
|
* Could be used to show a spinner etc.
|
|
@@ -4300,24 +4342,12 @@ declare type ResolveBehaviorEvent<
|
|
|
4300
4342
|
export declare type SchemaDefinition<
|
|
4301
4343
|
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
4302
4344
|
> = {
|
|
4303
|
-
decorators?: ReadonlyArray<TBaseDefinition
|
|
4304
|
-
blockObjects?: ReadonlyArray<
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
inlineObjects?: ReadonlyArray<
|
|
4310
|
-
TBaseDefinition & {
|
|
4311
|
-
fields?: ReadonlyArray<FieldDefinition>
|
|
4312
|
-
}
|
|
4313
|
-
>
|
|
4314
|
-
annotations?: ReadonlyArray<
|
|
4315
|
-
TBaseDefinition & {
|
|
4316
|
-
fields?: ReadonlyArray<FieldDefinition>
|
|
4317
|
-
}
|
|
4318
|
-
>
|
|
4319
|
-
lists?: ReadonlyArray<TBaseDefinition>
|
|
4320
|
-
styles?: ReadonlyArray<TBaseDefinition>
|
|
4345
|
+
decorators?: ReadonlyArray<DecoratorDefinition<TBaseDefinition>>
|
|
4346
|
+
blockObjects?: ReadonlyArray<BlockObjectDefinition<TBaseDefinition>>
|
|
4347
|
+
inlineObjects?: ReadonlyArray<InlineObjectDefinition<TBaseDefinition>>
|
|
4348
|
+
annotations?: ReadonlyArray<AnnotationDefinition<TBaseDefinition>>
|
|
4349
|
+
lists?: ReadonlyArray<ListDefinition<TBaseDefinition>>
|
|
4350
|
+
styles?: ReadonlyArray<StyleDefinition<TBaseDefinition>>
|
|
4321
4351
|
}
|
|
4322
4352
|
|
|
4323
4353
|
/** @beta */
|
|
@@ -4353,6 +4383,24 @@ declare type SlateEditor = {
|
|
|
4353
4383
|
|
|
4354
4384
|
declare type StrictExtract<T, U extends T> = U
|
|
4355
4385
|
|
|
4386
|
+
/**
|
|
4387
|
+
* @public
|
|
4388
|
+
*/
|
|
4389
|
+
export declare type StyleDefinition<
|
|
4390
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
4391
|
+
> = TBaseDefinition
|
|
4392
|
+
|
|
4393
|
+
/**
|
|
4394
|
+
* @public
|
|
4395
|
+
*/
|
|
4396
|
+
export declare type StyleSchemaType = BaseDefinition & {
|
|
4397
|
+
/**
|
|
4398
|
+
* @deprecated
|
|
4399
|
+
* Use `name` instead
|
|
4400
|
+
*/
|
|
4401
|
+
value: string
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4356
4404
|
/**
|
|
4357
4405
|
* @beta
|
|
4358
4406
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -283,6 +283,15 @@ export declare type AddedAnnotationPaths = {
|
|
|
283
283
|
spanPath: Path
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
/**
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
|
+
export declare type AnnotationDefinition<
|
|
290
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
291
|
+
> = TBaseDefinition & {
|
|
292
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
293
|
+
}
|
|
294
|
+
|
|
286
295
|
/**
|
|
287
296
|
* @public
|
|
288
297
|
*/
|
|
@@ -296,6 +305,13 @@ export declare type AnnotationPath = [
|
|
|
296
305
|
},
|
|
297
306
|
]
|
|
298
307
|
|
|
308
|
+
/**
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
export declare type AnnotationSchemaType = BaseDefinition & {
|
|
312
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
/**
|
|
300
316
|
* @public
|
|
301
317
|
*/
|
|
@@ -450,6 +466,22 @@ export declare interface BlockListItemRenderProps {
|
|
|
450
466
|
value: string
|
|
451
467
|
}
|
|
452
468
|
|
|
469
|
+
/**
|
|
470
|
+
* @public
|
|
471
|
+
*/
|
|
472
|
+
export declare type BlockObjectDefinition<
|
|
473
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
474
|
+
> = TBaseDefinition & {
|
|
475
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* @public
|
|
480
|
+
*/
|
|
481
|
+
export declare type BlockObjectSchemaType = BaseDefinition & {
|
|
482
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
483
|
+
}
|
|
484
|
+
|
|
453
485
|
/**
|
|
454
486
|
* @beta
|
|
455
487
|
*/
|
|
@@ -620,6 +652,24 @@ declare type DecoratedRange = BaseRange & {
|
|
|
620
652
|
rangeDecoration: RangeDecoration
|
|
621
653
|
}
|
|
622
654
|
|
|
655
|
+
/**
|
|
656
|
+
* @public
|
|
657
|
+
*/
|
|
658
|
+
export declare type DecoratorDefinition<
|
|
659
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
660
|
+
> = TBaseDefinition
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
export declare type DecoratorSchemaType = BaseDefinition & {
|
|
666
|
+
/**
|
|
667
|
+
* @deprecated
|
|
668
|
+
* Use `name` instead
|
|
669
|
+
*/
|
|
670
|
+
value: string
|
|
671
|
+
}
|
|
672
|
+
|
|
623
673
|
/**
|
|
624
674
|
* @public
|
|
625
675
|
* A helper wrapper that adds editor support, such as autocomplete and type checking, for a schema definition.
|
|
@@ -3074,63 +3124,18 @@ export declare type EditorProviderProps = {
|
|
|
3074
3124
|
* @public
|
|
3075
3125
|
*/
|
|
3076
3126
|
export declare type EditorSchema = {
|
|
3077
|
-
annotations: ReadonlyArray<
|
|
3078
|
-
BaseDefinition & {
|
|
3079
|
-
fields: ReadonlyArray<{
|
|
3080
|
-
name: string
|
|
3081
|
-
type: string
|
|
3082
|
-
}>
|
|
3083
|
-
}
|
|
3084
|
-
>
|
|
3127
|
+
annotations: ReadonlyArray<AnnotationSchemaType>
|
|
3085
3128
|
block: {
|
|
3086
3129
|
name: string
|
|
3087
3130
|
}
|
|
3088
|
-
blockObjects: ReadonlyArray<
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
name: string
|
|
3092
|
-
type: string
|
|
3093
|
-
}>
|
|
3094
|
-
}
|
|
3095
|
-
>
|
|
3096
|
-
decorators: ReadonlyArray<
|
|
3097
|
-
BaseDefinition & {
|
|
3098
|
-
/**
|
|
3099
|
-
* @deprecated
|
|
3100
|
-
* Use `name` instead
|
|
3101
|
-
*/
|
|
3102
|
-
value: string
|
|
3103
|
-
}
|
|
3104
|
-
>
|
|
3105
|
-
inlineObjects: ReadonlyArray<
|
|
3106
|
-
BaseDefinition & {
|
|
3107
|
-
fields: ReadonlyArray<{
|
|
3108
|
-
name: string
|
|
3109
|
-
type: string
|
|
3110
|
-
}>
|
|
3111
|
-
}
|
|
3112
|
-
>
|
|
3131
|
+
blockObjects: ReadonlyArray<BlockObjectSchemaType>
|
|
3132
|
+
decorators: ReadonlyArray<DecoratorSchemaType>
|
|
3133
|
+
inlineObjects: ReadonlyArray<InlineObjectSchemaType>
|
|
3113
3134
|
span: {
|
|
3114
3135
|
name: string
|
|
3115
3136
|
}
|
|
3116
|
-
styles: ReadonlyArray<
|
|
3117
|
-
|
|
3118
|
-
/**
|
|
3119
|
-
* @deprecated
|
|
3120
|
-
* Use `name` instead
|
|
3121
|
-
*/
|
|
3122
|
-
value: string
|
|
3123
|
-
}
|
|
3124
|
-
>
|
|
3125
|
-
lists: ReadonlyArray<
|
|
3126
|
-
BaseDefinition & {
|
|
3127
|
-
/**
|
|
3128
|
-
* @deprecated
|
|
3129
|
-
* Use `name` instead
|
|
3130
|
-
*/
|
|
3131
|
-
value: string
|
|
3132
|
-
}
|
|
3133
|
-
>
|
|
3137
|
+
styles: ReadonlyArray<StyleSchemaType>
|
|
3138
|
+
lists: ReadonlyArray<ListSchemaType>
|
|
3134
3139
|
}
|
|
3135
3140
|
|
|
3136
3141
|
/** @public */
|
|
@@ -3285,6 +3290,22 @@ export declare type HotkeyOptions = {
|
|
|
3285
3290
|
>
|
|
3286
3291
|
}
|
|
3287
3292
|
|
|
3293
|
+
/**
|
|
3294
|
+
* @public
|
|
3295
|
+
*/
|
|
3296
|
+
export declare type InlineObjectDefinition<
|
|
3297
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
3298
|
+
> = TBaseDefinition & {
|
|
3299
|
+
fields?: ReadonlyArray<FieldDefinition>
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
/**
|
|
3303
|
+
* @public
|
|
3304
|
+
*/
|
|
3305
|
+
export declare type InlineObjectSchemaType = BaseDefinition & {
|
|
3306
|
+
fields: ReadonlyArray<FieldDefinition>
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3288
3309
|
/**
|
|
3289
3310
|
* Used to represent native InputEvents that hold a DataTransfer object.
|
|
3290
3311
|
*
|
|
@@ -3303,6 +3324,9 @@ declare type InputBehaviorEvent = {
|
|
|
3303
3324
|
}
|
|
3304
3325
|
}
|
|
3305
3326
|
|
|
3327
|
+
/**
|
|
3328
|
+
* @beta
|
|
3329
|
+
*/
|
|
3306
3330
|
declare type InsertPlacement = 'auto' | 'after' | 'before'
|
|
3307
3331
|
|
|
3308
3332
|
declare type InternalEditor = Editor & {
|
|
@@ -3371,6 +3395,24 @@ declare type KeyboardBehaviorEvent =
|
|
|
3371
3395
|
*/
|
|
3372
3396
|
export declare const keyGenerator: () => string
|
|
3373
3397
|
|
|
3398
|
+
/**
|
|
3399
|
+
* @public
|
|
3400
|
+
*/
|
|
3401
|
+
export declare type ListDefinition<
|
|
3402
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
3403
|
+
> = TBaseDefinition
|
|
3404
|
+
|
|
3405
|
+
/**
|
|
3406
|
+
* @public
|
|
3407
|
+
*/
|
|
3408
|
+
export declare type ListSchemaType = BaseDefinition & {
|
|
3409
|
+
/**
|
|
3410
|
+
* @deprecated
|
|
3411
|
+
* Use `name` instead
|
|
3412
|
+
*/
|
|
3413
|
+
value: string
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3374
3416
|
/**
|
|
3375
3417
|
* The editor is currently loading something
|
|
3376
3418
|
* Could be used to show a spinner etc.
|
|
@@ -4300,24 +4342,12 @@ declare type ResolveBehaviorEvent<
|
|
|
4300
4342
|
export declare type SchemaDefinition<
|
|
4301
4343
|
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
4302
4344
|
> = {
|
|
4303
|
-
decorators?: ReadonlyArray<TBaseDefinition
|
|
4304
|
-
blockObjects?: ReadonlyArray<
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
inlineObjects?: ReadonlyArray<
|
|
4310
|
-
TBaseDefinition & {
|
|
4311
|
-
fields?: ReadonlyArray<FieldDefinition>
|
|
4312
|
-
}
|
|
4313
|
-
>
|
|
4314
|
-
annotations?: ReadonlyArray<
|
|
4315
|
-
TBaseDefinition & {
|
|
4316
|
-
fields?: ReadonlyArray<FieldDefinition>
|
|
4317
|
-
}
|
|
4318
|
-
>
|
|
4319
|
-
lists?: ReadonlyArray<TBaseDefinition>
|
|
4320
|
-
styles?: ReadonlyArray<TBaseDefinition>
|
|
4345
|
+
decorators?: ReadonlyArray<DecoratorDefinition<TBaseDefinition>>
|
|
4346
|
+
blockObjects?: ReadonlyArray<BlockObjectDefinition<TBaseDefinition>>
|
|
4347
|
+
inlineObjects?: ReadonlyArray<InlineObjectDefinition<TBaseDefinition>>
|
|
4348
|
+
annotations?: ReadonlyArray<AnnotationDefinition<TBaseDefinition>>
|
|
4349
|
+
lists?: ReadonlyArray<ListDefinition<TBaseDefinition>>
|
|
4350
|
+
styles?: ReadonlyArray<StyleDefinition<TBaseDefinition>>
|
|
4321
4351
|
}
|
|
4322
4352
|
|
|
4323
4353
|
/** @beta */
|
|
@@ -4353,6 +4383,24 @@ declare type SlateEditor = {
|
|
|
4353
4383
|
|
|
4354
4384
|
declare type StrictExtract<T, U extends T> = U
|
|
4355
4385
|
|
|
4386
|
+
/**
|
|
4387
|
+
* @public
|
|
4388
|
+
*/
|
|
4389
|
+
export declare type StyleDefinition<
|
|
4390
|
+
TBaseDefinition extends BaseDefinition = BaseDefinition,
|
|
4391
|
+
> = TBaseDefinition
|
|
4392
|
+
|
|
4393
|
+
/**
|
|
4394
|
+
* @public
|
|
4395
|
+
*/
|
|
4396
|
+
export declare type StyleSchemaType = BaseDefinition & {
|
|
4397
|
+
/**
|
|
4398
|
+
* @deprecated
|
|
4399
|
+
* Use `name` instead
|
|
4400
|
+
*/
|
|
4401
|
+
value: string
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4356
4404
|
/**
|
|
4357
4405
|
* @beta
|
|
4358
4406
|
*/
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import debug$f from "debug";
|
|
|
11
11
|
import { DOMEditor, isDOMNode } from "slate-dom";
|
|
12
12
|
import { getBlockStartPoint, getBlockKeyFromSelectionPoint, getChildKeyFromSelectionPoint, isTextBlock, parseBlock, parseAnnotation, blockOffsetToSpanSelectionPoint, parseInlineObject, isKeyedSegment, isSpan$1 as isSpan, isListBlock, isTypedObject, getSelectionStartPoint, getSelectionEndPoint, getTextBlockText, parseBlocks } from "./_chunks-es/selection-point.js";
|
|
13
13
|
import { getBlockEndPoint, isEmptyTextBlock, isEqualSelectionPoints } from "./_chunks-es/util.is-equal-selection-points.js";
|
|
14
|
-
import { isSelectionCollapsed, selectionPointToBlockOffset } from "./_chunks-es/util.
|
|
14
|
+
import { isSelectionCollapsed, selectionPointToBlockOffset, sliceTextBlock } from "./_chunks-es/util.slice-text-block.js";
|
|
15
15
|
import isEqual from "lodash/isEqual.js";
|
|
16
16
|
import { isSelectionCollapsed as isSelectionCollapsed$1, getFocusTextBlock, getFocusSpan as getFocusSpan$1, isSelectionExpanded, getFocusBlock as getFocusBlock$1, getSelectedValue, getFocusChild as getFocusChild$1 } from "./_chunks-es/selector.is-selection-expanded.js";
|
|
17
17
|
import { getFocusInlineObject, getSelectedBlocks, getSelectionStartBlock as getSelectionStartBlock$1, getSelectionEndBlock as getSelectionEndBlock$1, isOverlappingSelection, isSelectingEntireBlocks, getTrimmedSelection, getSelectedSpans, getCaretWordSelection, getFocusBlockObject, getPreviousBlock, getNextBlock, isAtTheEndOfBlock, isAtTheStartOfBlock, getFirstBlock as getFirstBlock$1, getLastBlock as getLastBlock$1, getFocusListBlock, isActiveAnnotation, isActiveDecorator, getSelectedTextBlocks, isActiveListItem, isActiveStyle, getActiveAnnotations as getActiveAnnotations$1 } from "./_chunks-es/selector.is-selecting-entire-blocks.js";
|
|
@@ -6912,13 +6912,13 @@ const coreDndBehaviors = [
|
|
|
6912
6912
|
anchor: selectionStartPoint,
|
|
6913
6913
|
focus: blockEndPoint
|
|
6914
6914
|
}, newTextBlock = parseBlock({
|
|
6915
|
-
block:
|
|
6916
|
-
...snapshot,
|
|
6915
|
+
block: sliceTextBlock({
|
|
6917
6916
|
context: {
|
|
6918
6917
|
...snapshot.context,
|
|
6919
6918
|
selection: newTextBlockSelection
|
|
6920
|
-
}
|
|
6921
|
-
|
|
6919
|
+
},
|
|
6920
|
+
block: focusTextBlock.node
|
|
6921
|
+
}),
|
|
6922
6922
|
context: snapshot.context,
|
|
6923
6923
|
options: {
|
|
6924
6924
|
refreshKeys: !0,
|
|
@@ -8086,9 +8086,6 @@ function resolveEnabledListItems(blockType) {
|
|
|
8086
8086
|
function findBlockType(type) {
|
|
8087
8087
|
return type.type ? findBlockType(type.type) : type.name === "block" ? type : null;
|
|
8088
8088
|
}
|
|
8089
|
-
function defineSchema(definition) {
|
|
8090
|
-
return definition;
|
|
8091
|
-
}
|
|
8092
8089
|
const temporaryImageName = `tmp-${defaultKeyGenerator()}-image`, temporaryUrlName = `tmp-${defaultKeyGenerator()}-url`, temporaryObjectNames = {
|
|
8093
8090
|
image: temporaryImageName,
|
|
8094
8091
|
url: temporaryUrlName
|
|
@@ -11462,6 +11459,9 @@ function EditorProvider(props) {
|
|
|
11462
11459
|
t8
|
|
11463
11460
|
] }), $[28] = internalEditor_0.editor, $[29] = t4, $[30] = t8, $[31] = t9) : t9 = $[31], t9;
|
|
11464
11461
|
}
|
|
11462
|
+
function defineSchema(definition) {
|
|
11463
|
+
return definition;
|
|
11464
|
+
}
|
|
11465
11465
|
const usePortableTextEditorSelection = () => {
|
|
11466
11466
|
const $ = c(3), editorActor = useContext(EditorActorContext), [selection, setSelection] = useState(null);
|
|
11467
11467
|
let t0, t1;
|