fix: add 'rel' attirubte to edit link (#3293)
This commit is contained in:
parent
783440e370
commit
5ea1554a07
@ -25,9 +25,7 @@ function getEmotionCache() {
|
||||
|
||||
const PreviewContainer = ({ children, highlight }) => (
|
||||
<CacheProvider value={getEmotionCache()}>
|
||||
<Layout>
|
||||
{highlight ? <Highlight>{children}</Highlight> : children}
|
||||
</Layout>
|
||||
<Layout>{highlight ? <Highlight>{children}</Highlight> : children}</Layout>
|
||||
</CacheProvider>
|
||||
);
|
||||
|
||||
@ -42,7 +40,7 @@ class Highlight extends React.Component {
|
||||
if (this.ref.current) {
|
||||
Prism.highlightAllUnder(this.ref.current);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@ -54,13 +52,9 @@ class Highlight extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div ref={this.ref}>
|
||||
{this.props.children}
|
||||
</div>
|
||||
);
|
||||
return <div ref={this.ref}>{this.props.children}</div>;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const BlogPostPreview = ({ entry, widgetFor }) => {
|
||||
const data = entry.get('data');
|
||||
@ -121,8 +115,7 @@ const NotificationPreview = ({ entry }) => (
|
||||
<Notification key={idx} url={notif.get('url')} loud={notif.get('loud')}>
|
||||
{notif.get('message')}
|
||||
</Notification>
|
||||
))
|
||||
}
|
||||
))}
|
||||
</PreviewContainer>
|
||||
);
|
||||
|
||||
|
@ -15,7 +15,7 @@ const EditLink = ({ collection, filename }) => (
|
||||
}
|
||||
`}
|
||||
>
|
||||
<a href={`/admin/#/edit/${collection}/${filename}`} target="_blank">
|
||||
<a href={`/admin/#/edit/${collection}/${filename}`} target="_blank" rel="noopener noreferrer">
|
||||
<svg
|
||||
version="1.1"
|
||||
id="pencil"
|
||||
|
@ -33,7 +33,7 @@ export const LayoutTemplate = ({ children }) => (
|
||||
<GlobalStyles />
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
)
|
||||
);
|
||||
|
||||
const Layout = ({ hasPageHero, children }) => {
|
||||
return (
|
||||
|
@ -127,7 +127,7 @@ const StyledMarkdown = styled.div`
|
||||
|
||||
const Markdown = ({ body, html }) => {
|
||||
if (body) {
|
||||
return <StyledMarkdown>{body}</StyledMarkdown>
|
||||
return <StyledMarkdown>{body}</StyledMarkdown>;
|
||||
}
|
||||
return <StyledMarkdown dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
};
|
||||
|
@ -12,7 +12,10 @@ import Widgets from '../components/widgets';
|
||||
import Markdown from '../components/markdown';
|
||||
|
||||
function filenameFromPath(p) {
|
||||
return p.split('/').slice(-1)[0].split('.')[0];
|
||||
return p
|
||||
.split('/')
|
||||
.slice(-1)[0]
|
||||
.split('.')[0];
|
||||
}
|
||||
|
||||
const toMenu = (menu, nav) =>
|
||||
@ -40,13 +43,9 @@ export const DocsTemplate = ({
|
||||
group,
|
||||
}) => (
|
||||
<Container size="md">
|
||||
<SidebarLayout
|
||||
sidebar={showSidebar && <DocsSidebar docsNav={docsNav} location={location} />}
|
||||
>
|
||||
<SidebarLayout sidebar={showSidebar && <DocsSidebar docsNav={docsNav} location={location} />}>
|
||||
<article data-docs-content>
|
||||
{filename && (
|
||||
<EditLink collection={`docs_${group}`} filename={filename} />
|
||||
)}
|
||||
{filename && <EditLink collection={`docs_${group}`} filename={filename} />}
|
||||
<h1>{title}</h1>
|
||||
<Markdown body={body} html={html} />
|
||||
{showWidgets && <Widgets widgets={widgets} />}
|
||||
@ -56,8 +55,13 @@ export const DocsTemplate = ({
|
||||
);
|
||||
|
||||
const DocPage = ({ data, location }) => {
|
||||
const { nav, page: { frontmatter, html, fields }, widgets, menu } = data;
|
||||
const { title, group } = frontmatter
|
||||
const {
|
||||
nav,
|
||||
page: { frontmatter, html, fields },
|
||||
widgets,
|
||||
menu,
|
||||
} = data;
|
||||
const { title, group } = frontmatter;
|
||||
|
||||
const docsNav = toMenu(menu.siteMetadata.menu.docs, nav);
|
||||
const showWidgets = location.pathname.indexOf('/docs/widgets') !== -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user