mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-17 11:07:07 +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
|
@ -92,14 +92,10 @@ module.exports = {
|
||||||
{
|
{
|
||||||
label: 'Privacy',
|
label: 'Privacy',
|
||||||
href: 'https://opensource.facebook.com/legal/privacy/',
|
href: 'https://opensource.facebook.com/legal/privacy/',
|
||||||
target: '_blank',
|
|
||||||
rel: 'noreferrer noopener',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Terms',
|
label: 'Terms',
|
||||||
href: 'https://opensource.facebook.com/legal/terms/',
|
href: 'https://opensource.facebook.com/legal/terms/',
|
||||||
target: '_blank',
|
|
||||||
rel: 'noreferrer noopener',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -111,6 +111,20 @@ const ColorModeSchema = Joi.object({
|
||||||
respectPrefersColorScheme: false,
|
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({
|
const ThemeConfigSchema = Joi.object({
|
||||||
// TODO temporary (@alpha-58)
|
// TODO temporary (@alpha-58)
|
||||||
disableDarkMode: Joi.any().forbidden(false).messages({
|
disableDarkMode: Joi.any().forbidden(false).messages({
|
||||||
|
@ -158,18 +172,7 @@ const ThemeConfigSchema = Joi.object({
|
||||||
links: Joi.array().items(
|
links: Joi.array().items(
|
||||||
Joi.object({
|
Joi.object({
|
||||||
title: Joi.string().required(),
|
title: Joi.string().required(),
|
||||||
items: Joi.array().items(
|
items: Joi.array().items(FooterLinkItemSchema).default([]),
|
||||||
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'),
|
|
||||||
),
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue