templates: ensure lexical link validation does not break for internal links (#10771)

This commit is contained in:
Alessio Gravili
2025-01-23 15:42:10 -07:00
committed by GitHub
parent b76401c101
commit 59545b5fe5
3 changed files with 18 additions and 0 deletions

View File

@@ -109,6 +109,12 @@ export default buildConfig({
},
label: ({ t }) => t('fields:enterURL'),
required: true,
validate: (value: any, options: any) => {
if (options?.siblingData?.linkType === 'internal') {
return true // no validation needed, as no url should exist for internal links
}
return value ? true : 'URL is required'
},
},
]
},

View File

@@ -33,6 +33,12 @@ export const defaultLexical: Config['editor'] = lexicalEditor({
},
label: ({ t }) => t('fields:enterURL'),
required: true,
validate: (value: any, options: any) => {
if (options?.siblingData?.linkType === 'internal') {
return true // no validation needed, as no url should exist for internal links
}
return value ? true : 'URL is required'
},
},
]
},

View File

@@ -33,6 +33,12 @@ export const defaultLexical: Config['editor'] = lexicalEditor({
},
label: ({ t }) => t('fields:enterURL'),
required: true,
validate: (value: any, options: any) => {
if (options?.siblingData?.linkType === 'internal') {
return true // no validation needed, as no url should exist for internal links
}
return value ? true : 'URL is required'
},
},
]
},