feat(richtext-lexical)!: link node: change doc data format to be consistent with relationship field (#4504)
BREAKING: An unpopulated, internal link node no longer saves the doc id under fields.doc.value.id. Now, it saves it under fields.doc.value. Migration inside of payload is automatic. If you are reading from the link node inside of your frontend, though, you will have to adjust it. The version property of the link and autoLink node has been changed from 1 to 2.
This commit is contained in:
@@ -54,7 +54,7 @@ export function generateLexicalRichText() {
|
||||
format: '',
|
||||
indent: 0,
|
||||
type: 'link',
|
||||
version: 1,
|
||||
version: 2,
|
||||
fields: {
|
||||
url: 'https://payloadcms.com',
|
||||
newTab: true,
|
||||
@@ -86,13 +86,11 @@ export function generateLexicalRichText() {
|
||||
format: '',
|
||||
indent: 0,
|
||||
type: 'link',
|
||||
version: 1,
|
||||
version: 2,
|
||||
fields: {
|
||||
url: 'https://',
|
||||
doc: {
|
||||
value: {
|
||||
id: '{{ARRAY_DOC_ID}}',
|
||||
},
|
||||
value: '{{ARRAY_DOC_ID}}',
|
||||
relationTo: 'array-fields',
|
||||
},
|
||||
newTab: false,
|
||||
|
||||
@@ -174,7 +174,6 @@ describe('Lexical', () => {
|
||||
)
|
||||
|
||||
expect(richTextDoc?.lexicalCustomFields).not.toStrictEqual(seededDocument) // The whole seededDocument should not match, as richTextDoc should now contain populated documents not present in the seeded document
|
||||
expect(richTextDoc?.lexicalCustomFields).toMatchObject(seededDocument) // subset of seededDocument should match
|
||||
|
||||
const lexical: SerializedEditorState = richTextDoc?.lexicalCustomFields
|
||||
|
||||
|
||||
Reference in New Issue
Block a user