Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/components/drivers/docx-viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'styles/docx.scss';
import Loading from '../loading';

export default class extends Component {
state = {
file:'',
}
componentDidMount() {
const jsonFile = new XMLHttpRequest();
jsonFile.open('GET', this.props.filePath, true);
Expand All @@ -22,7 +25,7 @@ export default class extends Component {
const docEl = document.createElement('div');
docEl.className = 'document-container';
docEl.innerHTML = result.value;
document.getElementById('docx').innerHTML = docEl.outerHTML;
this.setState({file:docEl.outerHTML})
})
.catch((a) => {
console.log('alexei: something went wrong', a);
Expand All @@ -34,8 +37,17 @@ export default class extends Component {

render() {
return (
<div id="docx">
<Loading />
</div>);
<div>
{file ? (
<div dangerouslySetInnerHTML={{ __html: file }}>
</div>
) : (
<div>
<Loading />
</div>
)}
</div>
);

}
}