Fix content type validation in create page view (#1205)
* Fix content type validation in create page view * Update changelog * Change disabled to valid
This commit is contained in:
parent
51dba9f43b
commit
ab54fc6d68
3 changed files with 7 additions and 2 deletions
|
@ -64,6 +64,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
|||
- Disable next step when no value selected in variant selector - #1218 by @orzechdev
|
||||
- Fix order links on home page - #1219 by @jwm0
|
||||
- Fix huge payload issue for plugins view - #1203 by @kamilpastuszka
|
||||
- Fix content type validation in create page view - #1205 by @orzechdev
|
||||
|
||||
# 2.11.1
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
|
|||
assignReferencesAttributeId={assignReferencesAttributeId}
|
||||
onSubmit={onSubmit}
|
||||
>
|
||||
{({ change, data, handlers, hasChanged, submit }) => (
|
||||
{({ change, data, valid, handlers, hasChanged, submit }) => (
|
||||
<Container>
|
||||
<AppHeader onBack={onBack}>
|
||||
{intl.formatMessage(sectionNames.pages)}
|
||||
|
@ -237,7 +237,7 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
|
|||
</div>
|
||||
</Grid>
|
||||
<SaveButtonBar
|
||||
disabled={loading || !hasChanged}
|
||||
disabled={loading || !hasChanged || !valid}
|
||||
state={saveButtonBarState}
|
||||
onCancel={onBack}
|
||||
onDelete={page === null ? undefined : onRemove}
|
||||
|
|
|
@ -74,6 +74,7 @@ export interface PageUpdateHandlers {
|
|||
export interface UsePageUpdateFormResult {
|
||||
change: FormChange;
|
||||
data: PageData;
|
||||
valid: boolean;
|
||||
handlers: PageUpdateHandlers;
|
||||
hasChanged: boolean;
|
||||
submit: () => void;
|
||||
|
@ -223,9 +224,12 @@ function usePageForm(
|
|||
? handleFormSubmit(getSubmitData(), handleSubmit, setChanged)
|
||||
: onSubmit(getSubmitData());
|
||||
|
||||
const valid = !!opts.selectedPageType;
|
||||
|
||||
return {
|
||||
change: handleChange,
|
||||
data: getData(),
|
||||
valid,
|
||||
handlers: {
|
||||
changeContent,
|
||||
changeMetadata,
|
||||
|
|
Loading…
Reference in a new issue