-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sitecore-jss-react] [sitecore-jss-nextjs] Default Placeholder Content for empty fields in editMode metadata #1831
Conversation
…iting components for text and image; modify Link and Text field components
…h withEmptyValueEditingPlaceholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work, thank you!
Let's refine it a bit
packages/sitecore-jss-react/src/enhancers/withEmptyValueEditingPlaceholder.tsx
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-react/src/enhancers/withEmptyValueEditingPlaceholder.tsx
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-react/src/enhancers/withEmptyValueEditingPlaceholder.tsx
Outdated
Show resolved
Hide resolved
…tingPlaceholder from sitecore-jss-nextjs package
786ecb2
to
c1164a7
Compare
… withEmptyFieldEditingComponent
…eld components; some renamings and additional code comments
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.tsx
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.tsx
Show resolved
Hide resolved
} | ||
|
||
return true; | ||
} else if (typeof fieldValue === 'number') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (typeof fieldValue === 'number') { | |
} else if (typeof fieldValue === 'number') { | |
// Avoid returning true for 0 |
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.tsx
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
Outdated
Show resolved
Hide resolved
expect(rendered.html()).to.equal(expected.html()); | ||
}); | ||
|
||
it('Should render custom empty value placeholder if provided via props if field value is empty in metadata edit mode', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('Should render custom empty value placeholder if provided via props if field value is empty in metadata edit mode', () => { | |
it('Should render custom empty component if provided via props if field value is empty in metadata edit mode', () => { |
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
Outdated
Show resolved
Hide resolved
…mments, update some existing comments
…eld components; update Image and Link unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
See some other comments below
Also, revisit comments:
1- #1831 (comment)
2- #1831 (comment)
packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description / Motivation
This PR enhances the rendering of fields in editing mode for editMode metadata. When a field value is empty, a placeholder content should be rendered to signify that the field has no value. The placeholder should be interactable, so user can add value to the field. Additionally developers can provide their own custom empty field placeholder component via the field's
emptyValueEditingPlaceholder
prop, which will be rendered instead of the default one.The fields with this functionality are:
Testing Details
Types of changes