Skip to content
Snippets Groups Projects
Commit ae59dd3d authored by Audrey Hamelers's avatar Audrey Hamelers
Browse files

Merge branch 'dev' into 'master'

Fix broken web preview image

See merge request !390
parents 3c8ba01f d1c12a4a
No related branches found
No related tags found
1 merge request!390Fix broken web preview image
app/assets/logo-wtpa2.gif

6.19 KiB

......@@ -5,9 +5,10 @@ import { createGlobalStyle } from 'styled-components'
import { th } from '@pubsweet/ui-toolkit'
import MathJax from '../../react-mathjax-preview-local'
import styles from '../../assets/epmc_new_plus.scss'
import emsHeader from '../../assets/logo-wtpa2.gif'
const CodeBox = createGlobalStyle`
#html-preview pre {
#html-preview pre, #html-preview pre code {
white-space: pre-wrap !important;
overflow-wrap: break-word;
border: 0 !important;
......@@ -67,26 +68,43 @@ class HTMLPreview extends React.Component {
{this.props.xml ? (
<React.Fragment>
<CodeBox />
<pre data-lang="xml">{this.state.html}</pre>
<pre>
<code className="language-xml">{this.state.html}</code>
</pre>
</React.Fragment>
) : (
ReactHtmlParser(this.state.html, {
transform: function transform(node, index) {
if (
node.type === 'tag' &&
node.name === 'span' &&
node.attribs.class === 'f mathjax mml-math'
) {
return (
<MathJax
id={node.attribs.id}
key={node.attribs.id}
math={node.children[0].data}
onDisplay={() => mathComplete(node.attribs.id)}
style={node.attribs.style}
wrapperTag="span"
/>
)
if (node.type === 'tag') {
if (
node.name === 'span' &&
node.attribs.class === 'f mathjax mml-math'
) {
return (
<MathJax
id={node.attribs.id}
key={node.attribs.id}
math={node.children[0].data}
onDisplay={() => mathComplete(node.attribs.id)}
style={node.attribs.style}
wrapperTag="span"
/>
)
}
if (
node.name === 'img' &&
node.attribs.src ===
'https://europepmc.org/corehtml/pmc/pmcgifs/logo-wtpa2.gif'
) {
return (
<a href="//plus.europepmc.org">
<img
alt="Europe PMC Funders Group Author Manuscript"
src={emsHeader}
/>
</a>
)
}
}
},
})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment