Merge remote-tracking branch 'origin/main' into feat/lexical-on-demand
This commit is contained in:
@@ -79,6 +79,7 @@ formBuilderPlugin({
|
||||
text: true,
|
||||
textarea: true,
|
||||
select: true,
|
||||
radio: true,
|
||||
email: true,
|
||||
state: true,
|
||||
country: true,
|
||||
@@ -293,14 +294,46 @@ Maps to a `textarea` input on your front-end. Used to collect a multi-line strin
|
||||
|
||||
Maps to a `select` input on your front-end. Used to display a list of options.
|
||||
|
||||
| Property | Type | Description |
|
||||
| -------------- | -------- | -------------------------------------------------------- |
|
||||
| `name` | string | The name of the field. |
|
||||
| `label` | string | The label of the field. |
|
||||
| `defaultValue` | string | The default value of the field. |
|
||||
| `width` | string | The width of the field on the front-end. |
|
||||
| `required` | checkbox | Whether or not the field is required when submitted. |
|
||||
| `options` | array | An array of objects with `label` and `value` properties. |
|
||||
| Property | Type | Description |
|
||||
| -------------- | -------- | ------------------------------------------------------------------------------- |
|
||||
| `name` | string | The name of the field. |
|
||||
| `label` | string | The label of the field. |
|
||||
| `defaultValue` | string | The default value of the field. |
|
||||
| `placeholder` | string | The placeholder text for the field. |
|
||||
| `width` | string | The width of the field on the front-end. |
|
||||
| `required` | checkbox | Whether or not the field is required when submitted. |
|
||||
| `options` | array | An array of objects that define the select options. See below for more details. |
|
||||
|
||||
#### Select Options
|
||||
|
||||
Each option in the `options` array defines a selectable choice for the select field.
|
||||
|
||||
| Property | Type | Description |
|
||||
| -------- | ------ | ----------------------------------- |
|
||||
| `label` | string | The display text for the option. |
|
||||
| `value` | string | The value submitted for the option. |
|
||||
|
||||
### Radio
|
||||
|
||||
Maps to radio button inputs on your front-end. Used to allow users to select a single option from a list of choices.
|
||||
|
||||
| Property | Type | Description |
|
||||
| -------------- | -------- | ------------------------------------------------------------------------------ |
|
||||
| `name` | string | The name of the field. |
|
||||
| `label` | string | The label of the field. |
|
||||
| `defaultValue` | string | The default value of the field. |
|
||||
| `width` | string | The width of the field on the front-end. |
|
||||
| `required` | checkbox | Whether or not the field is required when submitted. |
|
||||
| `options` | array | An array of objects that define the radio options. See below for more details. |
|
||||
|
||||
#### Radio Options
|
||||
|
||||
Each option in the `options` array defines a selectable choice for the radio field.
|
||||
|
||||
| Property | Type | Description |
|
||||
| -------- | ------ | ----------------------------------- |
|
||||
| `label` | string | The display text for the option. |
|
||||
| `value` | string | The value submitted for the option. |
|
||||
|
||||
### Email (field)
|
||||
|
||||
|
||||
@@ -139,20 +139,22 @@ export function PublishButton({ label: labelProp }: PublishButtonClientProps) {
|
||||
}
|
||||
})
|
||||
|
||||
const publish = useCallback(() => {
|
||||
const publish = useCallback(async () => {
|
||||
if (uploadStatus === 'uploading') {
|
||||
return
|
||||
}
|
||||
|
||||
void submit({
|
||||
const result = await submit({
|
||||
overrides: {
|
||||
_status: 'published',
|
||||
},
|
||||
})
|
||||
|
||||
setUnpublishedVersionCount(0)
|
||||
setMostRecentVersionIsAutosaved(false)
|
||||
setHasPublishedDoc(true)
|
||||
if (result) {
|
||||
setUnpublishedVersionCount(0)
|
||||
setMostRecentVersionIsAutosaved(false)
|
||||
setHasPublishedDoc(true)
|
||||
}
|
||||
}, [
|
||||
setHasPublishedDoc,
|
||||
submit,
|
||||
@@ -162,7 +164,7 @@ export function PublishButton({ label: labelProp }: PublishButtonClientProps) {
|
||||
])
|
||||
|
||||
const publishSpecificLocale = useCallback(
|
||||
(locale) => {
|
||||
async (locale) => {
|
||||
if (uploadStatus === 'uploading') {
|
||||
return
|
||||
}
|
||||
@@ -175,14 +177,16 @@ export function PublishButton({ label: labelProp }: PublishButtonClientProps) {
|
||||
globalSlug ? `/globals/${globalSlug}` : `/${collectionSlug}/${id ? `${'/' + id}` : ''}`
|
||||
}${params ? '?' + params : ''}`
|
||||
|
||||
void submit({
|
||||
const result = await submit({
|
||||
action,
|
||||
overrides: {
|
||||
_status: 'published',
|
||||
},
|
||||
})
|
||||
|
||||
setHasPublishedDoc(true)
|
||||
if (result) {
|
||||
setHasPublishedDoc(true)
|
||||
}
|
||||
},
|
||||
[api, collectionSlug, globalSlug, id, serverURL, setHasPublishedDoc, submit, uploadStatus],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user