@portabletext/editor 1.56.0 → 1.57.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/README.md +19 -0
- package/lib/behaviors/index.d.cts +1 -2
- package/lib/behaviors/index.d.ts +1 -2
- package/lib/index.cjs +11 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.js +11 -5
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +1 -2
- package/lib/plugins/index.d.ts +1 -2
- package/lib/selectors/index.d.cts +1 -2
- package/lib/selectors/index.d.ts +1 -2
- package/lib/utils/index.d.cts +1 -2
- package/lib/utils/index.d.ts +1 -2
- package/package.json +1 -1
- package/src/editor/editor-schema-definition.ts +1 -2
- package/src/editor/editor-schema.ts +6 -0
package/README.md
CHANGED
|
@@ -372,3 +372,22 @@ In order to provide a robust and consistent end-user experience, the editor is b
|
|
|
372
372
|
4. `cd` into the `sanity` package and run `pnpm link <relative path to the **editor** package in this repo>`
|
|
373
373
|
|
|
374
374
|
Now, you should be able to run `pnpm dev:test-studio` in the `sanity` repo to test Studio with a locally running Portable Text Editor.
|
|
375
|
+
|
|
376
|
+
## Other Libraries
|
|
377
|
+
|
|
378
|
+
This monorepo also contains additional libraries that can be used with the Portable Text Editor:
|
|
379
|
+
|
|
380
|
+
### `@portabletext/keyboard-shortcuts`
|
|
381
|
+
|
|
382
|
+
> A TypeScript library for creating platform-aware keyboard shortcuts with automatic detection of Apple vs non-Apple platforms.
|
|
383
|
+
|
|
384
|
+
- 💻 [./packages/keyboard-shortcuts](./packages/keyboard-shortcuts/)
|
|
385
|
+
- 📦 [@portabletext/keyboard-shortcuts](https://www.npmjs.com/package/@portabletext/keyboard-shortcuts)
|
|
386
|
+
|
|
387
|
+
### `@portabletext/toolbar`
|
|
388
|
+
|
|
389
|
+
> Powered by [Behaviors](https://www.portabletext.org/concepts/behavior/) and [State Machines](https://stately.ai/docs/xstate), `@portabletext/toolbar` is a collection of robust React hooks for building toolbars and related UI components
|
|
390
|
+
> for the Portable Text editor.
|
|
391
|
+
|
|
392
|
+
- 💻 [./packages/toolbar](./packages/toolbar/)
|
|
393
|
+
- 📦 [@portabletext/toolbar](https://www.npmjs.com/package/@portabletext/toolbar)
|
|
@@ -653,8 +653,7 @@ declare type ExtractNamespace<TType extends string> =
|
|
|
653
653
|
/**
|
|
654
654
|
* @public
|
|
655
655
|
*/
|
|
656
|
-
declare type FieldDefinition = {
|
|
657
|
-
name: string
|
|
656
|
+
declare type FieldDefinition = BaseDefinition & {
|
|
658
657
|
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
659
658
|
}
|
|
660
659
|
|
package/lib/behaviors/index.d.ts
CHANGED
|
@@ -653,8 +653,7 @@ declare type ExtractNamespace<TType extends string> =
|
|
|
653
653
|
/**
|
|
654
654
|
* @public
|
|
655
655
|
*/
|
|
656
|
-
declare type FieldDefinition = {
|
|
657
|
-
name: string
|
|
656
|
+
declare type FieldDefinition = BaseDefinition & {
|
|
658
657
|
type: 'string' | 'number' | 'boolean' | 'array' | 'object'
|
|
659
658
|
}
|
|
660
659
|
|
package/lib/index.cjs
CHANGED
|
@@ -8329,7 +8329,8 @@ function legacySchemaToEditorSchema(schema2) {
|
|
|
8329
8329
|
name: annotation.name,
|
|
8330
8330
|
fields: annotation.fields.map((field) => ({
|
|
8331
8331
|
name: field.name,
|
|
8332
|
-
type: field.type.jsonType
|
|
8332
|
+
type: field.type.jsonType,
|
|
8333
|
+
title: field.type.title
|
|
8333
8334
|
})),
|
|
8334
8335
|
title: annotation.title
|
|
8335
8336
|
})),
|
|
@@ -8340,7 +8341,8 @@ function legacySchemaToEditorSchema(schema2) {
|
|
|
8340
8341
|
name: blockObject.name,
|
|
8341
8342
|
fields: blockObject.fields.map((field) => ({
|
|
8342
8343
|
name: field.name,
|
|
8343
|
-
type: field.type.jsonType
|
|
8344
|
+
type: field.type.jsonType,
|
|
8345
|
+
title: field.type.title
|
|
8344
8346
|
})),
|
|
8345
8347
|
title: blockObject.title
|
|
8346
8348
|
})),
|
|
@@ -8353,7 +8355,8 @@ function legacySchemaToEditorSchema(schema2) {
|
|
|
8353
8355
|
name: inlineObject.name,
|
|
8354
8356
|
fields: inlineObject.fields.map((field) => ({
|
|
8355
8357
|
name: field.name,
|
|
8356
|
-
type: field.type.jsonType
|
|
8358
|
+
type: field.type.jsonType,
|
|
8359
|
+
title: field.type.title
|
|
8357
8360
|
})),
|
|
8358
8361
|
title: inlineObject.title
|
|
8359
8362
|
})),
|
|
@@ -8384,7 +8387,8 @@ function compileSchemaDefinitionToLegacySchema(definition) {
|
|
|
8384
8387
|
) : blockObject.title,
|
|
8385
8388
|
fields: blockObject.fields?.map((field) => ({
|
|
8386
8389
|
name: field.name,
|
|
8387
|
-
type: field.type
|
|
8390
|
+
type: field.type,
|
|
8391
|
+
title: field.title ?? startCase__default.default(field.name)
|
|
8388
8392
|
})) ?? []
|
|
8389
8393
|
})) ?? [], inlineObjects = definition?.inlineObjects?.map((inlineObject) => types.defineType({
|
|
8390
8394
|
type: "object",
|
|
@@ -8397,7 +8401,8 @@ function compileSchemaDefinitionToLegacySchema(definition) {
|
|
|
8397
8401
|
) : inlineObject.title,
|
|
8398
8402
|
fields: inlineObject.fields?.map((field) => ({
|
|
8399
8403
|
name: field.name,
|
|
8400
|
-
type: field.type
|
|
8404
|
+
type: field.type,
|
|
8405
|
+
title: field.title ?? startCase__default.default(field.name)
|
|
8401
8406
|
})) ?? []
|
|
8402
8407
|
})) ?? [], portableTextSchema = types.defineField({
|
|
8403
8408
|
type: "array",
|
|
@@ -8421,6 +8426,7 @@ function compileSchemaDefinitionToLegacySchema(definition) {
|
|
|
8421
8426
|
title: annotation.title,
|
|
8422
8427
|
fields: annotation.fields?.map((field) => ({
|
|
8423
8428
|
name: field.name,
|
|
8429
|
+
title: field.title ?? startCase__default.default(field.name),
|
|
8424
8430
|
type: field.type
|
|
8425
8431
|
})) ?? []
|
|
8426
8432
|
})) ?? []
|