-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix crash on transcriptions with ref attributes (#58)
- Loading branch information
1 parent
3808c5b
commit bd97f17
Showing
4 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import HtmlReactParser from 'html-react-parser'; | ||
|
||
// This component addresses a conflict between React and | ||
// documents whose elements contain `ref` attributes. | ||
// Because we're parsing transcription contents as React | ||
// elements, migrating TranscriptionView to a function | ||
// component caused React to error about the ref attributes. | ||
|
||
// The short-term fix is to wrap this simple class component | ||
// around the parser. | ||
|
||
class Parser extends React.Component { | ||
render() { | ||
const { html, htmlToReactParserOptionsSide } = this.props; | ||
|
||
return HtmlReactParser(html, htmlToReactParserOptionsSide); | ||
} | ||
} | ||
|
||
export default Parser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters