mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 00:09:48 +02:00
fix(v2): fix link items refusing attributes like target, rel etc... (#3168)
This commit is contained in:
parent
4af25cd597
commit
68f4bd00f4
2 changed files with 15 additions and 16 deletions
|
@ -111,6 +111,20 @@ const ColorModeSchema = Joi.object({
|
|||
respectPrefersColorScheme: false,
|
||||
});
|
||||
|
||||
const FooterLinkItemSchema = Joi.object({
|
||||
to: Joi.string(),
|
||||
href: Joi.string().uri(),
|
||||
html: Joi.string(),
|
||||
label: Joi.string(),
|
||||
})
|
||||
.xor('to', 'href', 'html')
|
||||
.with('to', 'label')
|
||||
.with('href', 'label')
|
||||
.nand('html', 'label')
|
||||
// We allow any unknown attributes on the links
|
||||
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
||||
.unknown();
|
||||
|
||||
const ThemeConfigSchema = Joi.object({
|
||||
// TODO temporary (@alpha-58)
|
||||
disableDarkMode: Joi.any().forbidden(false).messages({
|
||||
|
@ -158,18 +172,7 @@ const ThemeConfigSchema = Joi.object({
|
|||
links: Joi.array().items(
|
||||
Joi.object({
|
||||
title: Joi.string().required(),
|
||||
items: Joi.array().items(
|
||||
Joi.object({
|
||||
to: Joi.string(),
|
||||
href: Joi.string().uri(),
|
||||
html: Joi.string(),
|
||||
label: Joi.string(),
|
||||
})
|
||||
.xor('to', 'href', 'html')
|
||||
.with('to', 'label')
|
||||
.with('href', 'label')
|
||||
.nand('html', 'label'),
|
||||
),
|
||||
items: Joi.array().items(FooterLinkItemSchema).default([]),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue