Skip to content

Commit

Permalink
Upgrade dependencies, moved rendition.display after callback to getRe…
Browse files Browse the repository at this point in the history
…ndition in order to connect with hooks before inital render.
  • Loading branch information
gerhardsletten committed Jun 5, 2020
1 parent 51c89c8 commit d25c802
Show file tree
Hide file tree
Showing 4 changed files with 3,154 additions and 2,859 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ class App extends Component {
- `epubOptions` [object] - pass custom properties to the epub rendition, see [epub.js's book.renderTo function](http://epubjs.org/documentation/0.3/#bookrenderto)
- `getRendition` [func] - when epubjs has rendered the epub-file you can get access to the epubjs-rendition object here

#### Handling not valid epub-files

A tip if you have problems with not valid epub-files is to override the build in DOMParser and modify the markup-string passed to its parseFromString function. This example fixes a not valid `<title/>` tag in an old epub, which would render as a blank page if not fixed:

```
const DOMParser = window.DOMParser
class OwnParser {
parseFromString(markup, mime) {
if (markup.indexOf('<title/>') !== -1) {
markup = markup.replace('<title/>', '');
}
return new DOMParser().parseFromString(markup, mime)
}
}
window.DOMParser = OwnParser
```

#### Usage in cordova

There is a limitation with iframe and `srcdoc` so you need to add this to your config.xml to make react-reader work within an cordova application:
Expand Down
Loading

0 comments on commit d25c802

Please sign in to comment.