mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 08:57:03 +02:00
fix(v2): swizzle should receive correct load context (#1844)
* fix(v2): swizzle should receive correct load context * new prettier version * niits
This commit is contained in:
parent
b82e211546
commit
d96b5f99b9
21 changed files with 480 additions and 460 deletions
|
@ -44,9 +44,7 @@ class BlogPost extends React.Component {
|
|||
}`;
|
||||
if (post.authorFBID || post.authorImageURL) {
|
||||
const authorImageURL = post.authorFBID
|
||||
? `https://graph.facebook.com/${
|
||||
post.authorFBID
|
||||
}/picture/?height=200&width=200`
|
||||
? `https://graph.facebook.com/${post.authorFBID}/picture/?height=200&width=200`
|
||||
: post.authorImageURL;
|
||||
return (
|
||||
<div className={className}>
|
||||
|
|
|
@ -225,9 +225,7 @@ class Doc extends React.Component {
|
|||
editLink = (
|
||||
<a
|
||||
className="edit-page-link button"
|
||||
href={`${this.props.config.translationRecruitingLink}/${
|
||||
this.props.language
|
||||
}`}
|
||||
href={`${this.props.config.translationRecruitingLink}/${this.props.language}`}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener">
|
||||
{translateThisDoc}
|
||||
|
|
|
@ -22,9 +22,7 @@ class Head extends React.Component {
|
|||
// Use user-provided themeUrl if it exists, else construct one from version and theme.
|
||||
const highlightThemeURL = highlight.themeUrl
|
||||
? highlight.themeUrl
|
||||
: `//cdnjs.cloudflare.com/ajax/libs/highlight.js/${
|
||||
highlight.version
|
||||
}/styles/${highlight.theme}.min.css`;
|
||||
: `//cdnjs.cloudflare.com/ajax/libs/highlight.js/${highlight.version}/styles/${highlight.theme}.min.css`;
|
||||
|
||||
// ensure the siteUrl variable ends with a single slash
|
||||
const siteUrl = `${(
|
||||
|
@ -99,9 +97,7 @@ class Head extends React.Component {
|
|||
{this.props.config.gaTrackingId && this.props.config.gaGtag && (
|
||||
<script
|
||||
async
|
||||
src={`https://www.googletagmanager.com/gtag/js?id=${
|
||||
this.props.config.gaTrackingId
|
||||
}`}
|
||||
src={`https://www.googletagmanager.com/gtag/js?id=${this.props.config.gaTrackingId}`}
|
||||
/>
|
||||
)}
|
||||
{this.props.config.gaTrackingId && this.props.config.gaGtag && (
|
||||
|
|
|
@ -93,9 +93,7 @@ class Site extends React.Component {
|
|||
{this.props.config.facebookAppId && (
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `window.fbAsyncInit = function() {FB.init({appId:'${
|
||||
this.props.config.facebookAppId
|
||||
}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
||||
__html: `window.fbAsyncInit = function() {FB.init({appId:'${this.props.config.facebookAppId}',xfbml:true,version:'v2.7'});};(function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) {return;}js = d.createElement(s); js.id = id;js.src = '//connect.facebook.net/en_US/sdk.js';fjs.parentNode.insertBefore(js, fjs);}(document, 'script','facebook-jssdk'));
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -19,9 +19,7 @@ function anchors(md) {
|
|||
if (textToken.content) {
|
||||
const anchor = toSlug(textToken.content, env);
|
||||
|
||||
return `<h${
|
||||
tokens[idx].hLevel
|
||||
}><a class="anchor" aria-hidden="true" id="${anchor}"></a><a href="#${anchor}" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>`;
|
||||
return `<h${tokens[idx].hLevel}><a class="anchor" aria-hidden="true" id="${anchor}"></a><a href="#${anchor}" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>`;
|
||||
}
|
||||
|
||||
return originalRender(tokens, idx, options, env);
|
||||
|
|
|
@ -174,9 +174,7 @@ class HeaderNav extends React.Component {
|
|||
: '';
|
||||
const id = langPart + versionPart + link.doc;
|
||||
if (!Metadata[id]) {
|
||||
let errorStr = `Processing the following \`doc\` field in \`headerLinks\` within \`siteConfig.js\`: '${
|
||||
link.doc
|
||||
}'`;
|
||||
let errorStr = `Processing the following \`doc\` field in \`headerLinks\` within \`siteConfig.js\`: '${link.doc}'`;
|
||||
if (id === link.doc) {
|
||||
errorStr +=
|
||||
' It looks like there is no document with that id that exists in your docs directory. Please double check the spelling of your `doc` field and the `id` fields of your docs.';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue