Ability to add captions to images in the rich text editor #544
Replies: 1 comment 7 replies
-
Hey @AlessioGr — I have good news for you! This is possible right now. We are going to be releasing new series of guides and tutorials, and one of the tutorials planned is how to do exactly what you're looking for. There is a feature that we built, and its config is shown in the We'll be improving those docs once we launch the corresponding tutorial. But, the jist is that you can actually define "fields" for your rich text upload component, on a collection by collection basis. So, if you:
You could write your rich text field like this: import { Field } from 'payload/types';
const richTextFieldExample: Field = {
name: 'content',
type: 'richText',
admin: {
upload: {
collections: {
media: {
fields: [
// any fields that you would like to save
// on an upload element in the `media` collection
{
name: 'caption',
type: 'text',
}
],
},
},
},
}
} You can see above that we are specifying fields to show up on the The above is a screenshot from the Payload demo, where you can try this out on your own. How's that? |
Beta Was this translation helpful? Give feedback.
-
I would like to be able to set the caption for each specific image in the rich text editor (“upload” node type). Or, at least a checkbox as to when to enable the pre-set caption field.
This would give me more fine-grained control as to when the image caption should be displayed and when not.
Beta Was this translation helpful? Give feedback.
All reactions