templates: ensure lexical link validation does not break for internal links (#10771)
This commit is contained in:
@@ -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'
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
@@ -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'
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user