Skip to content

Commit c69cc8e

Browse files
🐛 bugfix: current percentage not working for epubs
1 parent 23838f3 commit c69cc8e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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)