Skip to content

Commit c28929d

Browse files
Merge pull request #283 from victorsoares96/bugfix/current-percentage-not-working-for-epubs
🐛 bugfix: current percentage not working for epubs
2 parents 23838f3 + 500ba84 commit c28929d

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@epubjs-react-native/core",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"description": "A digital book reader in .opf .epub format for react native using epub.js library inside a webview.",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/template.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ export default `
8787
8888
function getCfiFromHref(book, href) {
8989
const [_, id] = href.split('#')
90-
let section = book.spine.get(href.split('/')[1])
91-
92-
if (!section) {
93-
section = book.spine.get(href);
94-
}
90+
let section = book.spine.get(href.split('/')[1]) || book.spine.get(href) || book.spine.get(href.split('/').slice(1).join('/'))
9591
9692
const el = (id ? section.document.getElementById(id) : section.document.body)
9793
return section.cfiFromElement(el)

0 commit comments

Comments
 (0)