fix: styles readOnly RichTextEditor, removes interactivity within when readOnly
This commit is contained in:
@@ -73,12 +73,46 @@ const RichTextFields: CollectionConfig = {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'richTextReadOnly',
|
||||
type: 'richText',
|
||||
admin: {
|
||||
readOnly: true,
|
||||
link: {
|
||||
fields: [
|
||||
{
|
||||
name: 'rel',
|
||||
label: 'Rel Attribute',
|
||||
type: 'select',
|
||||
hasMany: true,
|
||||
options: [
|
||||
'noopener', 'noreferrer', 'nofollow',
|
||||
],
|
||||
admin: {
|
||||
description: 'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
upload: {
|
||||
collections: {
|
||||
uploads: {
|
||||
fields: [
|
||||
{
|
||||
name: 'caption',
|
||||
type: 'richText',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const richTextDoc = {
|
||||
selectHasMany: ['one', 'five'],
|
||||
richText: [
|
||||
function generateRichText() {
|
||||
return [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
@@ -220,7 +254,13 @@ export const richTextDoc = {
|
||||
],
|
||||
};
|
||||
}),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
export const richTextDoc = {
|
||||
selectHasMany: ['one', 'five'],
|
||||
richText: generateRichText(),
|
||||
richTextReadOnly: generateRichText(),
|
||||
};
|
||||
|
||||
export default RichTextFields;
|
||||
|
||||
@@ -92,6 +92,7 @@ export default buildConfig({
|
||||
|
||||
const richTextUploadIndex = richTextDocWithRelationship.richText.findIndex(({ type }) => type === 'upload');
|
||||
richTextDocWithRelationship.richText[richTextUploadIndex].value = { id: createdUploadDoc.id };
|
||||
richTextDocWithRelationship.richTextReadOnly[richTextUploadIndex].value = { id: createdUploadDoc.id };
|
||||
|
||||
await payload.create({ collection: 'rich-text-fields', data: richTextDocWithRelationship });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user