@portabletext/editor 1.56.0 → 1.57.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.
Files changed (34) hide show
  1. package/README.md +19 -0
  2. package/lib/_chunks-cjs/selector.get-focus-span.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  4. package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
  5. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
  6. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  7. package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
  8. package/lib/_chunks-es/selector.get-focus-span.js.map +1 -1
  9. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  10. package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
  11. package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
  12. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  13. package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
  14. package/lib/behaviors/index.d.cts +1 -2
  15. package/lib/behaviors/index.d.ts +1 -2
  16. package/lib/index.cjs +11 -5
  17. package/lib/index.cjs.map +1 -1
  18. package/lib/index.d.cts +1 -2
  19. package/lib/index.d.ts +1 -2
  20. package/lib/index.js +11 -5
  21. package/lib/index.js.map +1 -1
  22. package/lib/plugins/index.cjs.map +1 -1
  23. package/lib/plugins/index.d.cts +1 -2
  24. package/lib/plugins/index.d.ts +1 -2
  25. package/lib/plugins/index.js.map +1 -1
  26. package/lib/selectors/index.cjs.map +1 -1
  27. package/lib/selectors/index.d.cts +1 -2
  28. package/lib/selectors/index.d.ts +1 -2
  29. package/lib/selectors/index.js.map +1 -1
  30. package/lib/utils/index.d.cts +1 -2
  31. package/lib/utils/index.d.ts +1 -2
  32. package/package.json +9 -9
  33. package/src/editor/editor-schema-definition.ts +1 -2
  34. package/src/editor/editor-schema.ts +6 -0
package/lib/index.d.cts CHANGED
@@ -6246,8 +6246,7 @@ declare type ExtractNamespace<TType extends string> =
6246
6246
  /**
6247
6247
  * @public
6248
6248
  */
6249
- export declare type FieldDefinition = {
6250
- name: string
6249
+ export declare type FieldDefinition = BaseDefinition & {
6251
6250
  type: 'string' | 'number' | 'boolean' | 'array' | 'object'
6252
6251
  }
6253
6252
 
package/lib/index.d.ts CHANGED
@@ -6246,8 +6246,7 @@ declare type ExtractNamespace<TType extends string> =
6246
6246
  /**
6247
6247
  * @public
6248
6248
  */
6249
- export declare type FieldDefinition = {
6250
- name: string
6249
+ export declare type FieldDefinition = BaseDefinition & {
6251
6250
  type: 'string' | 'number' | 'boolean' | 'array' | 'object'
6252
6251
  }
6253
6252
 
package/lib/index.js CHANGED
@@ -8358,7 +8358,8 @@ function legacySchemaToEditorSchema(schema) {
8358
8358
  name: annotation.name,
8359
8359
  fields: annotation.fields.map((field) => ({
8360
8360
  name: field.name,
8361
- type: field.type.jsonType
8361
+ type: field.type.jsonType,
8362
+ title: field.type.title
8362
8363
  })),
8363
8364
  title: annotation.title
8364
8365
  })),
@@ -8369,7 +8370,8 @@ function legacySchemaToEditorSchema(schema) {
8369
8370
  name: blockObject.name,
8370
8371
  fields: blockObject.fields.map((field) => ({
8371
8372
  name: field.name,
8372
- type: field.type.jsonType
8373
+ type: field.type.jsonType,
8374
+ title: field.type.title
8373
8375
  })),
8374
8376
  title: blockObject.title
8375
8377
  })),
@@ -8382,7 +8384,8 @@ function legacySchemaToEditorSchema(schema) {
8382
8384
  name: inlineObject.name,
8383
8385
  fields: inlineObject.fields.map((field) => ({
8384
8386
  name: field.name,
8385
- type: field.type.jsonType
8387
+ type: field.type.jsonType,
8388
+ title: field.type.title
8386
8389
  })),
8387
8390
  title: inlineObject.title
8388
8391
  })),
@@ -8413,7 +8416,8 @@ function compileSchemaDefinitionToLegacySchema(definition) {
8413
8416
  ) : blockObject.title,
8414
8417
  fields: blockObject.fields?.map((field) => ({
8415
8418
  name: field.name,
8416
- type: field.type
8419
+ type: field.type,
8420
+ title: field.title ?? startCase(field.name)
8417
8421
  })) ?? []
8418
8422
  })) ?? [], inlineObjects = definition?.inlineObjects?.map((inlineObject) => defineType({
8419
8423
  type: "object",
@@ -8426,7 +8430,8 @@ function compileSchemaDefinitionToLegacySchema(definition) {
8426
8430
  ) : inlineObject.title,
8427
8431
  fields: inlineObject.fields?.map((field) => ({
8428
8432
  name: field.name,
8429
- type: field.type
8433
+ type: field.type,
8434
+ title: field.title ?? startCase(field.name)
8430
8435
  })) ?? []
8431
8436
  })) ?? [], portableTextSchema = defineField({
8432
8437
  type: "array",
@@ -8450,6 +8455,7 @@ function compileSchemaDefinitionToLegacySchema(definition) {
8450
8455
  title: annotation.title,
8451
8456
  fields: annotation.fields?.map((field) => ({
8452
8457
  name: field.name,
8458
+ title: field.title ?? startCase(field.name),
8453
8459
  type: field.type
8454
8460
  })) ?? []
8455
8461
  })) ?? []