Skip to content

Commit

Permalink
Merge pull request #279 from victorsoares96/bugfix/on-location-change…
Browse files Browse the repository at this point in the history
…-not-work-in-some-cases

bugfix: onLocationChange not work in some cases
  • Loading branch information
victorsoares96 authored Jun 3, 2024
2 parents 32edcb2 + 3210f77 commit ee4813d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@epubjs-react-native/core",
"version": "1.4.3",
"version": "1.4.4",
"description": "A digital book reader in .opf .epub format for react native using epub.js library inside a webview.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
7 changes: 6 additions & 1 deletion src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ export default `
function getCfiFromHref(book, href) {
const [_, id] = href.split('#')
const section = book.spine.get(href.split('/')[1])
let section = book.spine.get(href.split('/')[1])
if (!section) {
section = book.spine.get(href);
}
const el = (id ? section.document.getElementById(id) : section.document.body)
return section.cfiFromElement(el)
}
Expand Down

0 comments on commit ee4813d

Please sign in to comment.