Skip to content

Commit

Permalink
site: fix npm run site error
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Oct 31, 2018
1 parent 9e236fc commit 1f0263c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions site/theme/template/Content/Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ export default class Demo extends React.Component {

getSourceCode() {
const { highlightedCode } = this.props;
const div = document.createElement('div');
div.innerHTML = highlightedCode[1].highlighted;
return div.textContent;
if (typeof document !== 'undefined') {
const div = document.createElement('div');
div.innerHTML = highlightedCode[1].highlighted;
return div.textContent;
}
return '';
}

handleCodeExpand = () => {
Expand Down

0 comments on commit 1f0263c

Please sign in to comment.